Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Regular expression to split on .

Reply
Thread Tools

Regular expression to split on .

 
 
PC
Guest
Posts: n/a
 
      04-13-2005
Example:

my $string = abc\def.ghi\jkl

split( ".", $string) returns an empty list.

Any idea what I am doing wrong?

--
CIA DEA DIA FBI KGB NSA WMD TLA


 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      04-13-2005
PC wrote:
> Example:
> my $string = abc\def.ghi\jkl
> split( ".", $string) returns an empty list.
>
> Any idea what I am doing wrong?


Well, I would guess yes because apparently you are not happy with the
result.
However there is no way of saying what you are doing wrong because you
didn't tell us what you expect this code to do in the first place.

jue


 
Reply With Quote
 
 
 
 
PC
Guest
Posts: n/a
 
      04-14-2005

"Jürgen Exner" <(E-Mail Removed)> wrote in message
news:8Oh7e.15003$hB6.8780@trnddc06...
> PC wrote:
>> Example:
>> my $string = abc\def.ghi\jkl
>> split( ".", $string) returns an empty list.
>>
>> Any idea what I am doing wrong?

>
> Well, I would guess yes because apparently you are not happy with the
> result.
> However there is no way of saying what you are doing wrong because you
> didn't tell us what you expect this code to do in the first place.
>
> jue


The correct answer was split(/\./, $string)

Thanks.


 
Reply With Quote
 
Alex I. Varyanick
Guest
Posts: n/a
 
      04-24-2005
2005-04-13, PC <(E-Mail Removed)> ŠÉŪÅŌ:
> Example:
>
> my $string = abc\def.ghi\jkl
>
> split( ".", $string) returns an empty list.
>
> Any idea what I am doing wrong?
>


try this
perl -le '$a="qwe.rew.sa.ds"; @b=split /\./,$a; print "@b";'

--
Alex I. Varyanik http://www.velocityreviews.com/forums/(E-Mail Removed)-kpi.kiev.ua
ftp://cono.trinity.ntu-kpi.kiev.ua
ICQ:102575440
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to split a string with regular expression rhaavik Java 6 11-17-2005 10:19 AM
String.split regular expression - need help Richard Java 5 10-03-2005 11:32 PM
Regular Expression IGNORECASE different for findall and split? Chris Python 7 09-08-2005 07:43 PM
Regular Expression to Split Text with \r\n =?Utf-8?B?UmFlZCBTYXdhbGhh?= ASP .Net 1 03-22-2005 01:55 PM
Dynamically changing the regular expression of Regular Expression validator VSK ASP .Net 2 08-24-2003 02:47 PM



Advertisments