473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Regular expression to split on .

PC
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
Jul 19 '05 #1
3 4985
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
Jul 19 '05 #2
PC

"Jürgen Exner" <ju******@hotmail.com> 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.
Jul 19 '05 #3
2005-04-13, PC <PC******@Minneapolis.org> ÐÉÛÅÔ:
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 co**@trinity.ntu-kpi.kiev.ua
ftp://cono.trinity.ntu-kpi.kiev.ua
ICQ:102575440
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Sims | last post by:
Hi, I need some help to split data using regular expression Consider the string '1,2,3', I can split it using, preg_split("/,/", '1,2,3') and i correctly get =1, =2,=3. Now if i have
8
by: Michael McGarry | last post by:
Hi, I am horrible with Regular Expressions, can anyone recommend a book on it? Also I am trying to parse the following string to extract the number after load average. ".... load average:...
11
by: Martin Robins | last post by:
I am trying to parse a string that is similar in form to an OLEDB connection string using regular expressions; in principle it is working, but certain character combinations in the string being...
9
by: Schorschi | last post by:
Not having used regular expressions much, I need some help. Given a string... "This\0Guy\0Needs\0Some\0Help\0\0\0\0\0" Need result as array of strings... "This","Guy", "Needs", "Some", "Help" ...
5
by: Cylix | last post by:
I am going to write a function that the search engine done. in search engine, we may using double quotation to specify a pharse like "I love you", How can I using regular expression to sperate...
25
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
1
by: Steve Barnett | last post by:
I'm attempting my first regular expression (ok, I nicked some of it from a blog) and I'm not seeing the results I expect to see. Given that it does not work, I find myself entirely stuck. Can you...
6
by: GHUM | last post by:
I need to split a text at every ; (Semikolon), but not at semikolons which are "escaped" within a pair of $$ or $_$ signs. My guess was that something along this should happen withing csv.py;...
0
by: ahropak | last post by:
Hi, I have a question regarding a regular expression within Regex.Split() method which will help me to break each line of code into tokens. I'm trying to parse some lines of C# source code and...
6
by: lisong | last post by:
Hi All, I have problem to split a string like this: 'abc.defg.hij.klmnop' and I want to get all substrings with only one '.' in mid. so the output I expect is : 'abc.defg', 'defg.hij',...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.