Your regular expression /.*_?(.*)/ starts with .*, which matches any string of any length. The _?(.*) matches the empty string that remains after your first piece has matched everything. So you captured the empty string.
When you review the manual, pay special attention to the meaning of the quantifiers * and ?.
In reply to Re: regular expression
by Narveson
in thread regular expression
by Rahul Gupta
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |