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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.