On Sun, 2003-06-15 at 09:43, Steven Broos wrote:
> Hai
> 
> I'm trying to do a regular expression, which contains '
> As far as I know, I have to backslash the ' but that gives me an error.
> 
> expr that returns the part of a string between (' '):
> $ expr "dag('hello')goodafternoon" : '.*(\(.*\)).*'
>   'hello'
> $ expr "dag('hello')goodafternoon" : '.*('\(.*\)').*'
>   0
> $ expr "dag('hello')goodafternoon" : '.*(\'\(.*\)\').*'
>   bash: syntax error near unexpected token `)'
> $ expr "dag('hello')goodafternoon" : '.*(''\(.*\)'').*'
>   'hello'
> $ expr "dag('hello')goodafternoon" : '.*(.\(.*\).).*'
>   hello
> 
> Anyone has an idea how to contain a single quote in the expression ?
> I managed to work around this using just a point (last command above)
> but I really want to check for the quote 
> 
> tia
> Steven
Double quoting the regexp will do it:

expr "dag('hello')goodafternoon" : ".*('\(.*\)').*"

Adolfo


Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to