sandr vs Rex

source1Tamer
Posts: 91
Joined: Tue Nov 13, 2001 3:49 pm

sandr vs Rex

Post by source1Tamer »

I'm using rex to return a string, and then I want to BOLD this string,then I'm trying to use "sandr" function to look for the original string and replace with the new one, but sandr is not working at all...

<!--here is my rex (to return the first line of string):-->
<rex "[^\x0a]+" $bodypart>
<$origLine=$ret>
<$newLine="new">
<sandr $origLine $newLine $bodypart>

$ret here should include the $bodypart with the replaced portion but it sometimes returns only $newLine
and other times return nothing (it's inside a loop)

I thought that rex and sandr use the same behaviour of regular expressions...
any clews??
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

sandr vs Rex

Post by mark »

rex and sandr do use the same search expressions. Your rex will return every line of $bodypart, not just the first.
if $origLine contains characters that are special to rex/sandr the results may be unexpected. Just use sandr to do the replacement directly.

<sandr "[^\x0a]+" "new" $bodypart>