I liked the split method recommended above.
Unfortunately it doesn't work with multiple underscores.
If you want to stick with regexp, then try this:
if (/^(.*?)(?:_([^_]*))?\.pdf$/) { # do something with $1 and $2 }
In reply to Re^5: Pattern Matching in Arrays
by przemo
in thread Pattern Matching in Arrays
by aj.kohler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |