Page 1 of 1

sandr "+" plus sign

Posted: Sun Jun 05, 2016 11:55 am
by gerry.odea
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.

sandr "+" plus sign

Posted: Sun Jun 05, 2016 12:49 pm
by gerry.odea
figured it out, I needed to not encode it as %U before I applied the sandr. Gerry

sandr "+" plus sign

Posted: Sun Jun 05, 2016 9:34 pm
by gerry.odea
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

sandr "+" plus sign

Posted: Mon Jun 06, 2016 10:38 am
by mark
Your rule is somewhat vague, but here's one way:

<sandr ">>=[^\alpha]+" "" $query>
<sandr "[^\alpha]+>>=" "" $ret>

sandr "+" plus sign

Posted: Tue Jun 07, 2016 10:09 am
by gerry.odea
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

sandr "+" plus sign

Posted: Tue Jun 07, 2016 10:49 am
by mark
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.

sandr "+" plus sign

Posted: Tue Jun 07, 2016 11:59 am
by gerry.odea
<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 (`~!@#$%^&*()_-+={}][|\/";:<>,.)

sandr "+" plus sign

Posted: Tue Jun 07, 2016 1:00 pm
by mark
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.

sandr "+" plus sign

Posted: Fri Jun 10, 2016 2:10 pm
by gerry.odea
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?

sandr "+" plus sign

Posted: Fri Jun 10, 2016 2:57 pm
by mark
Need to escape the hyphen:

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