## sandr "+" plus sign

gerry.odea
Posts: 96
Joined: Fri Sep 19, 2008 9:33 am

### sandr "+" plus sign

I'm trying to figure out how to remove the spaces before and after a query. But they are not removing.

say the query is ++++++++gerry++++++ I want to remove all the pluses, I tried
<sandr ">>=\space+" "" $ret> <sandr "\space+>>=" ""$ret>
but no work, how do I do it?

Thanks.
gerry.odea
Posts: 96
Joined: Fri Sep 19, 2008 9:33 am

### sandr "+" plus sign

figured it out, I needed to not encode it as %U before I applied the sandr. Gerry
gerry.odea
Posts: 96
Joined: Fri Sep 19, 2008 9:33 am

### sandr "+" plus sign

how would I remove the following, before and after the Gerry queries below?
...........Gerry.............
,,,,,,,,,,,Gerry,,,,,,,,,,,,,,
;;;;;;;;;;;Gerry;;;;;;;;;;;;;
=====Gerry======
--------Gerry----------
*******Gerry*********
######Gerry######
~~~~~~~~Gerry~~~~~~
_________Gerry_______
^^^^^^^^^^^Gerry^^^^^^^^^
>>>>>>>>Gerry>>>>>>>>>
?????????Gerry???????

Thanks, Gerry
mark
Posts: 5495
Joined: Tue Apr 25, 2000 6:56 pm

### sandr "+" plus sign

Your rule is somewhat vague, but here's one way:

<sandr ">>=[^\alpha]+" "" $query> <sandr "[^\alpha]+>>=" ""$ret>
gerry.odea
Posts: 96
Joined: Fri Sep 19, 2008 9:33 am

### sandr "+" plus sign

but they are included in the query, so I need to know how to get them out of
the query.

like if I had a query=" gerry "

i would use

<sandr ">>=\space+" "" $q><sandr "\space+>>=" ""$ret>

but if i had a query="++++++++++++++++++++++++++++++gerry++++++++++++++++++"

how would I just remove the pluses, but leave the gerry?

or if I had
query="********************************************gerry****************************************"

how would I just remove the asterisks, but leave the gerry?

Thanks,
Gerry
mark
Posts: 5495
Joined: Tue Apr 25, 2000 6:56 pm

### sandr "+" plus sign

The code I supplied would take care of both of those cases. If that's not what you want please define a precise rule. e.g. The code I provided satisfies the rule "Remove all non-alphabetics from the head and tail". Or at least describe why my rule isn't what you want.
gerry.odea
Posts: 96
Joined: Fri Sep 19, 2008 9:33 am

### sandr "+" plus sign

<sandr ">>=[^\alnum]+" "" $q> <sandr "[^\alnum]+>>=" ""$ret>

works, because it doesn't remove the numbers in the query. all I wanted to remove where the unusual symbols that were not wanted in the front and the back of the query. like (~!@#$%^&*()_-+={}][|\/";:<>,.) mark Site Admin Posts: 5495 Joined: Tue Apr 25, 2000 6:56 pm ### sandr "+" plus sign Just adjust the sub-expression for the undesired characters, escaping special ones as needed: [~!@#\x24%^&*()_-+={}\][|\\/\x22;:<>,.]+ or invert and specify what's desired as I and you did with [^\alpha] and [^\alnum] respectively. gerry.odea Posts: 96 Joined: Fri Sep 19, 2008 9:33 am ### sandr "+" plus sign When I change it to: [~!@#\x24%^&*()_-+={}\][|\\/\x22;:<>,.]+ so <sandr ">>=[~\!@#\x24%^&*()_-+={}\][|\\/\x22;:<>,.]+" ""$q>
<sandr "[~\!@#\x24%^&*()_-+={}\][|\\/\x22;:<>,.]+>>=" "" \$ret>

I get this error:
<!-- 015 /search:873: REX: Invalid range sequence [~\!@#\x24%^&*()_-+={}\][|\\/\x22;:<>,.]' at offset +3 in the function f3par -->
<!-- 015 /search:873: REX: Invalid range sequence [~\!@#\x24%^&*()_-+={}\][|\\/\x22;:<>,.]' at offset +0 in the function f3par -->

any ideas what is causing it?
mark
Posts: 5495
Joined: Tue Apr 25, 2000 6:56 pm

### sandr "+" plus sign

Need to escape the hyphen:

[~!@#\x24%^&*()_\-+={}\][|\\/\x22;:<>,.]+