Home > Enterprise >  Regex Identify the specific pattern
Regex Identify the specific pattern

Time:11-25

Regex need to identify the specific pattern

mixexecutor:check_atom_exists:740 - requested to check this machine : ET_colBackDDW_Temp mixexecutor:check_atom_exists:740 - requested to check this machine : AT_colBackDDW_Temp mixexecutor:check_atom_exists:740 - requested to check this machine : FT_colSetDDW_Temp mixexecutor:check_atom_exists:740 - requested to check this machine : KT_colBackDDW_Temp

Extract :: ET_colBackDDW_Temp, AT_colBackDDW_Temp, FT_colSetDDW_Temp, KT_colBackDDW_Temp

CodePudding user response:

Demo: regexr.com/6a5u2

Pattern: mixexecutor:check_atom_exists:\d - requested to check this machine : (\w )

substitution: Group 1 i.e. $1

CodePudding user response:

You can try a simple way: search for the -, then the : and the word after that is captured.

[^-] -[^:] :\s*([^\s] )
  • [^-] finds characters which are not the -
  • - finds the - after
  • [^:] finds characters which are not the :
  • : finds the : after
  • \s* makes us ignore white-space
  • ([^\s] ) finds the word as "everything but white-space"

You can play around with it here:
https://regex101.com/r/M0OULn/1

  • Related