I have such strings:
Work Company TKA-A120
Work Company TKA-120
I want to get two values.
- TKA for both cases
- 120 but only for second string when there are three digits without letter before “-”. If not no Regex found.
I dont know how to find such regex to be working for these strings
HI @Marek_Matuszak try this regex pattern
Let me know if it works for you
i want something more like 3 upper cases in first case
If all strings always follow the pattern you mentioned above, I’d use a Split and TryParse. Something like this:
If output is true it means there is no letter after hyphen. Then, you can use stringVar.Split("-"c)(1) to get 120, for example.
Considering output as false, you can use same expression to get A120, for example. But I understood you don’t need this one.
To retrieve the letters before hyphen, for both cases you could use:
In addition, you can follow this idea using Invoke Method. It would be much better
Also, regex is another way. If you want to use it, feel free.