sandr question

Post Reply
basement_addict
Posts: 78
Joined: Mon Nov 19, 2001 5:20 pm

sandr question

Post by basement_addict »

Hi,

If I have this string

+W+R +otherterm +moreterms

I am trying to remove single char terms that are prefixed by a + and followed by a space. I don't want to remove the "+R " above since the term being searched on is "W+R".

If the string was:
+A +otherterm +moreterms

I would want the "+A " removed

But if the string was:

+C +otherterm +moreterms

I would want to keep the "+C " since C is the only 1 character term we allow searching on (C programming).


This is my starting point

<sandr "\+[0-9ABD-Zabd-z]\space" "" $var>


Thanks.
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

sandr question

Post by mark »

Start by putting leading and trailing space on.
<strfmt " %s " $var><$var=$ret>
Then your expression with a leading space should work
<sandr "\space\P=\+[0-9ABD-Zabd-z]=\F\space" "" $var>
leave the spaces in so terms don't get run together.
Post Reply