This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

[regsub] Parsing problem

Help for those learning Tcl or writing their own scripts.
Post Reply
Z
ZeRoMe
Voice
Posts: 2
Joined: Mon May 01, 2006 5:40 am
Location: France

[regsub] Parsing problem

Post by ZeRoMe »

Hello!
Sorry I'm french and my english is'nt verry good ^^
For explain my problem view this example:

.tcl set text {[email=my@email.com]Mon email[/email] [email]my@email.com[/email]}
This is OK.

And when I use:
.tcl regsub -- {\[email=(.*)\](.*)\[/email\]} $text "<a href='mailto:\\1'>\\2</a>" text2; putlog "\00304$text2"

The result is:
<a href='mailto:my@email.com]Jerome[/email] email: [email'>my@email.com</a>

But i want obtain this:
<a href='mailto:my@email.com>Jerome</a> email: <a href='mailto:my@email.com'>my@email.com</a>

Thank you for your help.
Sorry for my english ^^
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

probably you just need to add another number like "\\1<a href='mailto:\\2'>\\3</a>".
Addionally I would suggest using .*? instead of .* to get the smallest wildcard, not the largest.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Post Reply