Regular Expressions 101

Community Patterns

Find all words between #text#

1

Regular Expression
PCRE2 (PHP >=7.3)

~
[^<>](?![^<]*>|[^<>]*<\/)(?!\s\#\s)(\#\S[^<>](?![^<]*>|[^<>]*<\/)(.*?)\S\#)
~
mUg

Description

Finds all occurence in a plain text / html text where a text is between 2 hashtags : #text#

Submitted by Kervan Mazuy - 8 months ago