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

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
You've got it almost right, from what I can see. Your post looks a little strange (you'll notice your brackets are missing) because PerlMonks uses brackets to make linking easier in posts (anything in brackets links to the node named whatever's within the brackets). In the future, you'll probably want to put <code> tags around any code you post.

From what I can see, your regexp looks like this: /^[A-Za-z0-9]/ There's only one small error- the ^ is outside of the brackets. A caret outside of brackets means 'match this regexp at the beginning of a string'. If you move it inside: /[^A-Za-z0-0]/ you should find that it does what you want it to.

Incidentally, there are two shortcuts you might be interested in. You can use the escape sequence "\w" to mean "match all alphanumeric characters plus '_'", and "\W" to mean "match everything but \w". So if it's ok for you to add "_" to the class of characters that are ok to find, the whole thing can be shortened to /\W/.

A good place to look for more information on this is the perlre man page. Happy Perling!
--
Love justice; desire mercy.

In reply to Re: Regex help by strider corinth
in thread Regex help by Angel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2023-09-26 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?