How it works
- Give it the text and the pattern; turn on All to get every match instead of just the first.
- Advanced options keep only one group of the first match, by number or name, and ignore upper and lower case.
- It returns the match, the list of matches, a count and whether anything was found; no match is not an error.
- Each pattern search is limited to 100 milliseconds, so a runaway pattern fails instead of hanging.
Routines that use it
Order number from mail
Get the clipboard, find a pattern like a 6-digit number and type it with Type text.
All links
Find every web address in a text file read with Read text file and open them with Open URLs.
Window title part
On Window title changed, extract the song name and show it in a banner.
Settings
| Setting | What it does |
|---|---|
| Text | The text to search. |
| Pattern | A regular expression, such as \\d+ for a number or [\\w.]+@[\\w.]+ for an email address. |
| All | Find every match, not just the first. |
| Groupadvanced | Only keep one group of the first match: its number (1, 2…) or its name. |
| Ignore caseadvanced | Ignore upper and lower case. |
Good to know
- Uses regular expressions, which take some learning.
- Each search has a 100 millisecond limit.
Questions
- Does KeyRoutines support regex?
- Yes. Find with a pattern and Replace text both take regular expressions, and Compare values has a matches test.
- What happens if nothing matches?
- The step still succeeds and its found result is false, so you can check it with an If.