Page 1 of 1

guidence through the swamp of regular expressions

Posted: Mon Apr 05, 2004 2:13 am
by compound_eye
in my previous post:

search and replace : how does [url=http://somewhere] work?

i was asking about search and replace,
the essence of the question is

if i seach for the pattern {:tag:}
where tag is a specified name such as 'text'

{:text:}

and there can be whitespace and more text after x, but before the colon

{:tag extraStuff)

{:text bold:}
{:username red:}

is there a way i can use regular expressions
1: to find the pattern,
2: extract the 'extraStuff',
3: put together a new string using the extraStuff
4: then replace the tag with the new string?

if it makes any difference i can
change the format of the tag

eg

{:tag: extraStuff}
or
{:tag:}#extraStuff#

whatever works and is straight forward

cheers, mat