How could I trim this variable so that it does not contain the () and everything inside it?
PHO-11111706 (Please quote this reference in all correspondence with us)
PHO-11111706(Please quote this reference in all correspondence with us)
the action does not seam to work
Actually, do a Search instead of a Search and Replace, and use (\d+)
unless there’s information afterwards that you want to keep.
Or use a search and replace, with a regex search of:
([^\d]*)(\d+)(.*)
and a replace of
$2
https://regex101.com/r/wWt0nL/1
Use a KM Action "Search Variable":
^(.*?) *\(
Set Variable 1. to "Trimmed Result"
This also eliminates any spaces between the desired text and the opening parenthesis.
Note that if your "Source_Text" is multi-line, then this will find and trim ONLY the first instance of the matched text.
![](https://forum.keyboardmaestro.com/uploads/default/original/2X/5/55e831f017ac525bf61f10a0900a3033b35cb658.png)
![](https://forum.keyboardmaestro.com/uploads/default/original/2X/4/4369f3afc646fddc824da45b370ed6a781581aeb.png)