Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Why do I get regexp chars in split?

by idsfa (Vicar)
on Oct 11, 2006 at 16:40 UTC ( #577653=note: print w/replies, xml ) Need Help??

in reply to Why do I get regexp chars in split?

You don't want (capturing) parentheses, you want square brackets (a character class, see perlre):

my $string = "foo / bar & etc"; my @parts = split(m# [&/] #,$string); print join("\n",@parts,"");

(Note the extra null string to tack a newline onto the "etc", and the use of a different matching delimiter to avoid the need to escape the forward slash -- the ampersand never needed to be escaped )

The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://577653]
[LanX]: (they are pronounced differently)
[choroba]: perl -Mutf8 -Mfeature=fc -wE 'say fc "straße" eq fc "strasse"'
[choroba]: returns 1 for me
[choroba]: are they?
[LanX]: strict rules : the a is long in "straße" and short in "strasse"
[choroba]: So the "a" is different, not the "s" ;-)
[LanX]: people knowing that it's a workaround will pronounce it right
[LanX]: well
[LanX]: Maße and Masse are two very different words.
LanX (measures/mass)

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2018-03-21 15:47 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (268 votes). Check out past polls.