Re: selecting a part of a string

2006-09-24 Thread Rob Dixon
John W. Krahn wrote: > Rob Dixon wrote: > >>Adriano Allora wrote: >> >>>$tex =~ s/^([^|]+).*/$1/o; >> >>Your regex is correct, but it doesn't do what you said you wanted! You're >>substituting the entire string in $tex for just those characters up to >>the first >>pipe, but there's nothing

Re: selecting a part of a string

2006-09-23 Thread John W. Krahn
Rob Dixon wrote: > Adriano Allora wrote: >> >> $tex =~ s/^([^|]+).*/$1/o; > > Your regex is correct, but it doesn't do what you said you wanted! You're > substituting the entire string in $tex for just those characters up to > the first > pipe, but there's nothing in $tex - the data has be

Re: selecting a part of a string

2006-09-23 Thread Mumia W.
On 09/23/2006 07:07 PM, Rob Dixon wrote: [...] If you want to do what you said, and put everything up to the pipe into a variable (scalar $tex?) then /([^|]+)/; $tex = $1; [...] No, you should always only use the match variables after you've determined that the match was successful: /^(

Re: selecting a part of a string

2006-09-23 Thread Rob Dixon
Adriano Allora wrote: > > hi to all, > > another silly question about a pattern matching which should work but it > doesn't. > > I have a list af string similar to this one: > > parola|n.c.,0,fem,sg,0|parola > > and I need to select all the chars before the pipe and put them in a > variable. >

Re: selecting a part of a string

2006-09-23 Thread D. Bolliger
Adriano Allora am Sunday, 24. September 2006 01:12: > hi to all, > > another silly question about a pattern matching which should work but > it doesn't. > > I have a list af string similar to this one: > > parola|n.c.,0,fem,sg,0|parola > > and I need to select all the chars before the pipe an

Re: selecting a part of a string

2006-09-23 Thread John W. Krahn
Adriano Allora wrote: > hi to all, Hello, > another silly question about a pattern matching which should work but it > doesn't. > > I have a list af string similar to this one: > > parola|n.c.,0,fem,sg,0|parola > > and I need to select all the chars before the pipe and put them in a > vari