Regular Expression to match pattern

Xandour

I am trying to find all matches for the two following lines:

:Potato: Potato(3) :

and

:Tomato: 11 

Of course these words (Potato,Tomato) can be random words and the numbers from 1-99 .

Any help would be very appreciated.

Toto
  • Ctrl+F
  • Find what: :[a-z]+:\h*(?:[a-z]+\([1-9]\d?\)\h*:|[1-9]\d?\b)
  • UNCHECK Match case
  • CHECK Wrap around
  • CHECK Regular expression
  • Find All in Current Document

Explanation:

:           # 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 (before):

enter image description here

Screenshot (after):

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Regular Expression - Match String Pattern

From Dev

How to match a Unicode letter with a JSON Schema pattern (regular expression)

From Dev

Regular Expression to match a pattern that contain some string except some string

From Dev

How to match patterns in a larger pattern using regular expression?

From Dev

Regular Expression to match specific pattern (PHP)

From Dev

Regular Expression pattern does not match my requirements

From Dev

Regular expression pattern to match only links without www

From Dev

Playframework with Deadbolt 2: Pattern regular expression not match

From Dev

Why regular expression pattern does not match only in Python?

From Dev

looking for a regular expression to match specific decimal format in ng-pattern

From Dev

Regular expression to match specific pattern

From Dev

How to match regular expression exactly in R and pull out pattern

From Dev

Can regular expression match this pattern?

From Dev

Regular expression - match after specified pattern

From Dev

Regular expression to match a pattern in HTML code

From Dev

Regular expression match a or b pattern

From Dev

Combine variable and regular expression in pattern match

From Dev

PHP special regular expression pattern to match URLs after a specific string

From Dev

Regular Expression to match the sequence pattern

From Dev

Regular Expression - Match String Pattern

From Dev

How to match a Unicode letter with a JSON Schema pattern (regular expression)

From Dev

Regular Expression to match a pattern that contain some string except some string

From Dev

Regular Expression to match specific pattern (PHP)

From Dev

looking for correct regular expression for pattern match in javascript

From Dev

Playframework with Deadbolt 2: Pattern regular expression not match

From Dev

PHP preg_match() regular expression pattern match issues with whitespace

From Dev

Regular expression to match specific pattern

From Dev

Python Regular Expression expression excluiding string containing pattern match

From Dev

Scala: Regular Expression pattern match with curly braces?

Related Related

  1. 1

    Regular Expression - Match String Pattern

  2. 2

    How to match a Unicode letter with a JSON Schema pattern (regular expression)

  3. 3

    Regular Expression to match a pattern that contain some string except some string

  4. 4

    How to match patterns in a larger pattern using regular expression?

  5. 5

    Regular Expression to match specific pattern (PHP)

  6. 6

    Regular Expression pattern does not match my requirements

  7. 7

    Regular expression pattern to match only links without www

  8. 8

    Playframework with Deadbolt 2: Pattern regular expression not match

  9. 9

    Why regular expression pattern does not match only in Python?

  10. 10

    looking for a regular expression to match specific decimal format in ng-pattern

  11. 11

    Regular expression to match specific pattern

  12. 12

    How to match regular expression exactly in R and pull out pattern

  13. 13

    Can regular expression match this pattern?

  14. 14

    Regular expression - match after specified pattern

  15. 15

    Regular expression to match a pattern in HTML code

  16. 16

    Regular expression match a or b pattern

  17. 17

    Combine variable and regular expression in pattern match

  18. 18

    PHP special regular expression pattern to match URLs after a specific string

  19. 19

    Regular Expression to match the sequence pattern

  20. 20

    Regular Expression - Match String Pattern

  21. 21

    How to match a Unicode letter with a JSON Schema pattern (regular expression)

  22. 22

    Regular Expression to match a pattern that contain some string except some string

  23. 23

    Regular Expression to match specific pattern (PHP)

  24. 24

    looking for correct regular expression for pattern match in javascript

  25. 25

    Playframework with Deadbolt 2: Pattern regular expression not match

  26. 26

    PHP preg_match() regular expression pattern match issues with whitespace

  27. 27

    Regular expression to match specific pattern

  28. 28

    Python Regular Expression expression excluiding string containing pattern match

  29. 29

    Scala: Regular Expression pattern match with curly braces?

HotTag

Archive