Regex to match whole words that begin with $

后端 未结 6 1837
心在旅途
心在旅途 2021-01-01 18:14

I need a regex to match whole words that begin with $. What is the expression, and how can it be tested?

Example:

This $word and $this should

6条回答
  •  青春惊慌失措
    2021-01-01 18:54

    This should be self-explanatory:

    \$\p{Alphabetic}[\p{Alphabetic}\p{Dash}\p{Quotation_Mark}]*(?

    Notice it doesn’t try to match digits or underscores are other silly things that words don’t have in them.

提交回复
热议问题