Removing all right of special Characters with Regex

Hi, I tried to fix this myself but am running into some issues.

I want to delete all text to the right of some special Characters ( "," "/" "-" - etc)

This one \..*$ works at regexr.com but not in Keyboard Maestro (as an Example for ".")

The intent is to have text that is like
XXX.YYY
XXX - YYY
XXX/YYY

To be turned into XXX

Thanks for your help

Taking the first chunk resulting from a split can simplify the regular expression pattern that is needed.

Perhaps for example, starting with something like this, and adding any further characters that you want to specify as delimiting:

Text until punctuation.kmmacros (4.3 KB)

By default . only matches non-line terminator characters, and $ will match only the start and end of the text. So in

XXX.YYY
XXX - YYY
XXX/YYY

\..*$

will not match because the .* only matches until the end of the line, and the $ will only match at the end of the text.

If you wish to match everything from the . onwards until the end of the text, then you need to turn on the s flag option with either: \.(?s:.)* or (?s)\..*.

Note in both cases you don't need the $ (or better \z) because the .* will match everything until the end of the text.