For Programmers: Free Programming Magazines  


Home > Archive > AWK > June 2004 > Regular expression









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Regular expression
Rani Sawade

2004-04-14, 7:30 pm

Hi,
I am not sure whether such a regular expression can be formed.

But my requirement is some thing like this.
I want to convert a string "aaaNNcc" to "BNNBcBcB" or "BNNBcBc"
It is something like replacing "zero or more occurence of a (i e a*),
but not N" with B.
The 'N's should be touched.

I am trying the substitution with sed command.
ie
echo "aaaNNcc" | sed -e 's/paatern/replacement/g'


Thanks in advance,
Rani




Gnarlodious

2004-04-14, 8:30 pm

Entity Rani Sawade spoke thus:

> I want to convert a string "aaaNNcc" to "BNNBcBcB" or "BNNBcBc"
> It is something like replacing "zero or more occurence of a (i e a*),
> but not N" with B.
> The 'N's should be touched.
>
> I am trying the substitution with sed command.
> ie
> echo "aaaNNcc" | sed -e 's/paatern/replacement/g'


do shell script "echo 'aaaNNcc' | sed -e 's/a*/B/' -e 's/c/Bc/g' "

-- Gnarlie

Rani Sawade

2004-04-15, 12:31 pm

Is it possible to have it done through a single substitution in sed?


Gnarlodious wrote:

> Entity Rani Sawade spoke thus:
>
>
> do shell script "echo 'aaaNNcc' | sed -e 's/a*/B/' -e 's/c/Bc/g' "
>
> -- Gnarlie


Wesoly

2004-06-09, 3:55 pm

Wesoly wrote:

|| I try to write te regular expression that will match fo example:
||
|| /*
|| /*printtext(NULL, NULL, MSGLEVEL_CLIENTNOTICE
||
|| but not
||
|| /* close connection */

^[ \t]*\/\*\s* sth like that match all those example that i've wrote.
What should I add to this regexpr to ignore lines with ' */' on end ?

--
DW


Paul Bullack

2004-06-10, 3:55 pm

Hello,

try this

..*[^<blank>\*\/]$

Paul


"Wesoly" <wesoly@klu..pl> schrieb im Newsbeitrag
news:ca70go$4gr$1@news.dialog.net.pl...
> Wesoly wrote:
>
> || I try to write te regular expression that will match fo example:
> ||
> || /*
> || /*printtext(NULL, NULL, MSGLEVEL_CLIENTNOTICE
> ||
> || but not
> ||
> || /* close connection */
>
> ^[ \t]*\/\*\s* sth like that match all those example that i've wrote.
> What should I add to this regexpr to ignore lines with ' */' on end ?
>
> --
> DW
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com