Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^(.+?)\. Last message: (.+\.?) (\w[^AMP].+?)\.$
/
gmi

Description

Use AppleScript to get the Chat Description from the selected Chat. That is the source text for this RegEx.

This RegEx extracts the following fields:   • Buddy Name (or Phone# or Ref# if Buddy is NOT a Contact)   • Last Message   • Date/Time of last message.

The ending of the Chat Description can vary a lot. • It may, or may NOT be preceded with a period.   • Date/Time may be any of:     • Date only     • Time only     • Relative date, like "Yesterday"

Submitted by JMichaelTX - 8 years ago