
Ich versuche, alle Übereinstimmungen für die folgenden beiden Zeilen zu finden:
:Potato: Potato(3) :
Und
:Tomato: 11
Natürlich können diese Wörter (Kartoffel, Tomate) beliebige Wörter und Zahlen von 1-99 sein.
Ich wäre für jede Hilfe sehr dankbar.
Antwort1
- Ctrl+F
- Finde was:
:[a-z]+:\h*(?:[a-z]+\([1-9]\d?\)\h*:|[1-9]\d?\b)
- DEAKTIVIEREN Groß-/Kleinschreibung beachten
- ÜBERPRÜFEN Umwickeln
- ÜBERPRÜFEN Regulären Ausdruck
- Find All in Current Document
Erläuterung:
: # colon
[a-z]+ # 1 or more letter
: # colon
\h* # 0 or more horizontal spaces
(?: # non capture group
[a-z]+ # 1 or more letter
\( # opening parenthesis
[1-9] # digit between 1 and 9
\d? # 1 optional digit
\) # closing parenthesis
\h* # 0 or more horizontal spaces
: # colon
| # OR
[1-9] # digit between 1 and 9
\d? # 1 optional digit
\b # word boundary, make sure we haven't digit after
) # end group
Screenshot (vorher):
Screenshot (nachher):