Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: New regex trick...

by broquaint (Abbot)
on Jul 22, 2002 at 19:34 UTC ( [id://184196]=note: print w/replies, xml ) Need Help??


in reply to New regex trick...

So \K basically means don't worry, I only started matching *here*, where here is the position where the previous atom of the regex stopped matching e.g
my $str = "foo bar baz"; # will 'start' matching here ^ $str =~ s< (?: \w+ [ ] )+ \K \w+ >()x; print '[' . $str . ']'; __output__ [foo bar ]
Or should I just go back to implementing pointers in perl?
HTH

_________
broquaint

update: added missing whitespace in output (odd how an additional character requires so many to explain ;)

Replies are listed 'Best First'.
Re: Re: New regex trick...
by japhy (Canon) on Jul 22, 2002 at 19:50 UTC
    You've got the right idea (except for a missing whitespace in your output).

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://184196]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-20 02:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found