match [ or ] character

V

vlsidesign

Guest
I am trying to search for labels that have brackets [ ], and replace
them with < >. I am having trouble using rex pattern matching, it
"seems" like I am not able to do this. I tried using backslash before
the bracket.
 
, and replace
them with < >. I am having trouble using rex pattern matching, it
"seems" like I am not able to do this. I tried using backslash before
the bracket.
An easy way to do this is to use parseString.

x = parseString( text "[]" )
when( length(x) > 1
text = strcat( car(x) "<" cadr(x) ">" )
)

Using regexps, carefully escape the backslashes :

rexCompile("\\[\\([0-9]+\\)\\]")
rexReplace(text "<\\1>" 1)


Stéphane
 

Welcome to EDABoard.com

Sponsor

Back
Top