I hate asking for help (some searches usually find the answer), but I can't figure this one out....
I need to strip a handful of possible characters off the end of a variable and have been playing with trim, str_replace and preg_replace with no luck. I can get them to work fine with a specific name/characters but not one that covers all possible options.
Our employees desktop and laptops use a standard naming convention that could have multiple characters at the end of their device name which is based on their name. I am trying to strip off all characters to just get the employee name.
Here are some examples of our devices name:
JDOE
JDOE_L
JDOE-L
JDOE-L2 (or any numeric range such as 2-9)
JDOE2 (or any numeric range such as 2-9)
I am trying to get only the JDOE from the device name.
Any help would be great. Thanks!