Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Created·2023-06-09 00:57
Flavor·PCRE2 (PHP)

/
^FWD:\[(?<pid>[0-9]{4})\] (?<prog>.+\.exe): (?<msg>.*)$
/
gm
Open regex in editor

Description

Trying to get groups to work in PB

CreateRegularExpression(0,"^FWD:[(?<pid>[0-9]{4})] (?<prog>.+.exe): (?<msg>.*)$") x$ = "FWD:[1234] something else.exe: a bunch of text"

If MatchRegularExpression(0,x$)
  Debug RegularExpressionNamedGroup(0,"pid")
  Debug RegularExpressionNamedGroup(0,"prog")
  Debug RegularExpressionNamedGroup(0,"msg")
EndIf 
Submitted by anonymous