Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Checking whether a string is a prefix of any string matching a given regular expression

by bsb (Priest)
on Jan 16, 2006 at 17:13 UTC ( [id://523548]=note: print w/replies, xml ) Need Help??


in reply to Checking whether a string is a prefix of any string matching a given regular expression

I think the technique used in Generating regex strings with a regex might be adapted to your problem. Using (?{}) blocks allows you to get inside regex processing to a degree.

The Regexp::Genex module based on the above transforms a regex using YAPE::Regex, you could write a similar transform to answer your question. The transformed version would have to be peppered with an illegible sequence of (?{}) terms although I don't know what form it would take. Something like:

/^(\d(\d(\d(-(\d(\d(\d$)|$)|$)|$)|$)|$)|$)/
  • Comment on Re: Checking whether a string is a prefix of any string matching a given regular expression
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-18 05:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found