It seems further clarification would be helpful. What do you want to do in the case that there is more than one 'X'? (Or is that case not in your requirements?) If such a case won't exist, or if you want to get everything after the last 'X', I stand by my original suggestion. Use /([^X]*)$/.
If you can have more than one 'X' and you want everything after the first X then something like /^(?:.*?X)?(.*)$/ should do the trick.
-sauoq "My two cents aren't worth a dime.";
In reply to Re: Re: Capturing everything after an optional character in a regex?
by sauoq
in thread Capturing everything after an optional character in a regex?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |