Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Java 8

"
(?i)((face*book|(\bface.*book|face.*book.com\b/)).+\d)|(face.*book)|(\bface.*book|face.*book.com\b/.*id\S+\d)|(face.*book.com\b/.*id.\d+.*)
"
gm

Description

A general regular expression that uses the keywords 'Facebook' and 'id' to collect strings that contain Facebook IDs. Also, added an additional condition to where if there's a long numeric string it will be match a group given that, 'Facebook' is within the string. This is a special use-case and can be removed, I believe group 2.

Submitted by loganmcampbell - 3 years ago