Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: How would you write this RegExp?

by Anonymous Monk
on Jul 26, 2016 at 21:32 UTC ( [id://1168593]=note: print w/replies, xml ) Need Help??


in reply to How would you write this RegExp?

This guy is called a caret. :-)

You will need the following:

  • 0+ arithmetic to make the result a 0/1 boolean
  • Anchors ^$ at the regex pattern, to force a full match
  • A character class [] in the regex for your accepted set
  • A repetition * (or +) after the character class
Did you read the documentation?

Replies are listed 'Best First'.
Re^2: How would you write this RegExp?
by harangzsolt33 (Chaplain) on Jul 26, 2016 at 22:57 UTC
    Well, I have read the documentation, but it's so long, by the time I get to the end, I forget everything else. lol I downloaded an Android app called RegEx GUI, which asks a bunch of questions and is supposed to help you build a regex, but it didn't help me.. :-(

    I think, the most complicated part of learning the Perl language is understanding how to write and interpret regular expressions. I still don't understand how to do it. It's a big mess. and everytime somebody writes a long !$,\\.m./*(/&/\/%(\/_\/*!/@Y\/%/\@\\\\$H&*(P!//(/@*&/P/@/#!/$/^/-//-^xqfa34s*(67)_w/0//P@\/UI\.\.\ I am like oh, wow!!! what is that!? :-O Haha :D

      And don't forget Damian Conway's Regexp::Debugger. It does a very good job of showing, in full, glorious, mind-numbing detail, every step of the regexp processing sequence.

      --MidLifeXis

Log In?
Username:
Password:

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

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

    No recent polls found