Re: [SPAM DETECT] split and grouping in regexp



"XM" == Xavier Mas <xaviermasr@xxxxxx> writes:

XM> A Dimarts 31 Octubre 2006 02:22, Daniel Kasak va escriure:
>> my ( $yyyy, $mm, $dd ) = split /(-|\/)/, $yyyymmdd;

XM> split function can't accept an expression on its syntax, only a
XM> character as separator field.

where did you learn that mistaken fact? it is completely wrong. in fact
it is the opposite, as split ONLY takes a regex for its first arg. you
can't just pass it a string or a char, they are converted to a regex.

uri

--
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
.



Relevant Pages

  • Re: Parse and Compare Text Files
    ... > I think my biggest ... > problem is the regex in the split function, because what this does is match ... > ONLY against the first column in the line, when I need it to match anything ...
    (perl.beginners)
  • Re: Getting substring by regex
    ... Well, I know the Pattern class, but I don't think it could help here. ... You were probably thinking of the split function (Which seems to do ... in all these examples there is only one character as "regex. ... chop of this part from the String... ...
    (comp.lang.java.programmer)
  • Re: [SPAM DETECT] split and grouping in regexp
    ... split function can't accept an expression on its syntax, only a character as ... separator field. ... To Xavier Mas: ...
    (perl.beginners)