Re: Newbie Regular expression question

2005-04-08 Thread John W. Krahn
N. Ganesh Babu wrote: Hi John, Hello, I am new to understanding and how to use modules in perl programs. I have downloaded and installed the Modules you specified. The documentation in that I can not able to understand. Can you please help with a sample code. I'm sorry, I haven't used that modul

Re: Newbie Regular expression question

2005-04-08 Thread N. Ganesh Babu
Hi John, I am new to understanding and how to use modules in perl programs. I have downloaded and installed the Modules you specified. The documentation in that I can not able to understand. Can you please help with a sample code. Thanks in advance. Regards, Ganesh John W. Krahn wrote: N. Ganes

Re: Newbie Regular expression question

2005-04-08 Thread John W. Krahn
N. Ganesh Babu wrote: Thank you very much for you help. One more small help. fourth string B. van Sures to be tagged as B.van Sures fifth string van Sures, B., to be tagged as van SuresB. sixth string Bockris, O. M. J., to be tagged as BockrisO. M.J. All 6 should be converted in a single rege

Re: Newbie Regular expression question

2005-04-07 Thread N. Ganesh Babu
Dear John, Thank you very much for you help. One more small help. fourth string B. van Sures to be tagged as B.van Sures fifth string van Sures, B., to be tagged as van SuresB. sixth string Bockris, O. M. J., to be tagged as BockrisO. M.J. All 6 should be converted in a single regex. Regards, G

Re: Newbie Regular expression question

2005-04-05 Thread John W. Krahn
N. Ganesh Babu wrote: Dear All, Hello, I have to convert these lines into individual part of name information with a single regular expression. Input: B. E. Conway, J. O. M. Bockris B. Conway Output: B.E.Conway J.O. M. Bockris B. Conway Can anybody help me in getting the single regular expressi

Newbie Regular expression question

2005-04-05 Thread N. Ganesh Babu
Dear All, I have to convert these lines into individual part of name information with a single regular expression. Input: B. E. Conway, J. O. M. Bockris B. Conway Output: B.E.Conway J.O. M. Bockris B. Conway Can anybody help me in getting the single regular expression. Thanks for the help. Rega

Re: Newbie: regular expression

2004-05-03 Thread James Edward Gray II
On May 3, 2004, at 4:58 AM, Traeder, Philipp wrote: You're right - I didn't read the original question closely enough. For the record: If you want to strip trailing newlines, use chomp. If you want to strip newlines anywhere else, use regexes. Or tr/\n//d; James -- To unsubscribe, e-mail: [EMA

RE: Newbie: regular expression

2004-05-03 Thread Jose Alves de Castro
On Mon, 2004-05-03 at 10:58, Traeder, Philipp wrote: > For the record: > If you want to strip trailing newlines, use chomp. > If you want to strip newlines anywhere else, use regexes. And, if you want to strip trailing characters (no matter what they are; let's say you know there's always a traili

Re: Newbie: regular expression

2004-05-03 Thread Jose Alves de Castro
On Mon, 2004-05-03 at 11:02, Owen wrote: > What happens if you try s/\\n/HI/ > (untested) That would replace a backslash followed by the 'n' character with "HI". >From the original message: $_="Hi. \n This is test string"; So there is no backslash followed by an 'n' in $_ (actually, there isn'

Re: Newbie: regular expression

2004-05-03 Thread Owen
On Mon, 3 May 2004 15:00:20 +0530 "Durai" <[EMAIL PROTECTED]> wrote: > Hello All, > > I am having the following lines of code to remove "\n" from string. > > $_="Hi. \n This is test string"; > s/ > (\n) > /HI > /xisg; > > print; > > I expected the output like: > > Hi. HI This is test string

RE: Newbie: regular expression

2004-05-03 Thread Traeder, Philipp
> On Mon, 2004-05-03 at 10:46, Traeder, Philipp wrote: > > chomp might be the easiest (and probably fastest) solution. > > True :-) But the '\n' he was looking for was in the middle of the > sentence :-) > > BTW, I kept the trailing 'g' in the substitution just because I didn't > knew what the in

RE: Newbie: regular expression

2004-05-03 Thread Jose Alves de Castro
On Mon, 2004-05-03 at 10:46, Traeder, Philipp wrote: > chomp might be the easiest (and probably fastest) solution. True :-) But the '\n' he was looking for was in the middle of the sentence :-) BTW, I kept the trailing 'g' in the substitution just because I didn't knew what the input text might b

RE: Newbie: regular expression

2004-05-03 Thread Traeder, Philipp
> The problem is that the second part of the substitution (HI) is not > taken as a regex, but as a string, which is to mean that you're trying > to replace "\n" with "HI\n". > > If you were using > > s/ > (\n) > /HI/xisg; > > instead, you wouldn't have that problem. > > > Now that we've been

Re: Newbie: regular expression

2004-05-03 Thread John W. Krahn
Durai wrote: > > Hello All, Hello, > I am having the following lines of code to remove "\n" from string. > > $_="Hi. \n This is test string"; > s/ > (\n) > /HI > /xisg; > > print; > > I expected the output like: > > Hi. HI This is test string > > But I got: > > Hi. HI > This is test str

Re: Newbie: regular expression

2004-05-03 Thread Jose Alves de Castro
Hi. The problem is that the second part of the substitution (HI) is not taken as a regex, but as a string, which is to mean that you're trying to replace "\n" with "HI\n". If you were using s/ (\n) /HI/xisg; instead, you wouldn't have that problem. Now that we've been through the problem, le

Newbie: regular expression

2004-05-03 Thread Durai
Hello All, I am having the following lines of code to remove "\n" from string. $_="Hi. \n This is test string"; s/ (\n) /HI /xisg; print; I expected the output like: Hi. HI This is test string But I got: Hi. HI This is test string Anything wrong? Regs, Durai. --- Outgoing mail is c