I have a question regarding regular expressions in PHP. I'm currently working on a project where I need to validate a string that may contain an optional underscore followed by a number. However, I'm not very experienced with regular expressions, so I'm struggling a bit with it.
For example, the string could be "hello_1" or "world", and both should be considered valid. Basically, the underscore and number part should be optional.
I would really appreciate it if someone could help me with a regular expression that accomplishes this. Thank you in advance for your assistance!