Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: RegExp substitution

by AnomalousMonk (Archbishop)
on Apr 10, 2014 at 22:40 UTC ( [id://1081887]=note: print w/replies, xml ) Need Help??


in reply to Re^2: RegExp substitution
in thread RegExp substitution

... (?: , | \b)). ? allows the preceeding character to be optional (but there is no preceeding character?) and I can't see the use of a colon in this context.

The  (?:pattern) construct defines a non-capturing group. See Extended Patterns in perlre. This and other statements in your reply lead me to suggest that you take a big step backwards and read up on basic regex docs. Please see perlre. In particular, see perlretut for a very good tutorial. (I'm not familiar with the material in the Cozens book.) See also perlrequick for a quick reference. See also the material in the "Pattern Matching, Regular Expressions, and Parsing" area of the Tutorials section of this site.

Replies are listed 'Best First'.
Re^4: RegExp substitution
by Keystone (Initiate) on Apr 11, 2014 at 07:17 UTC

    Thanks, I've just come across (?:pat) this morning when I woke up to have another go at the problem and thought I'd finish the chapter of Cozens book first. I'm also taking a look at the perldoc and tutorials (actually after only a few moments of reading I realised where I was going wrong and why $2 $3 and $4 don't exist!). Because perl matches as soon as it can, as much as it can and ends as soon as it can it was never going to find anything beyond 'Three' with the match I was making, (a very blunt and undetailed statment rewording your earlier post).

    However overall I think the exercise has been a sucess, I made the program to check my understanding of RegEx and it has lead to the discovery of new material to help me with this and future problems. I'll look at resolving this problem again once I have covered the material.

    Thank you for your patience,

    Regards,

    Keystone.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-04-18 06:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found