Edit with '#' by regex
source link: https://www.codesd.com/item/edit-with-by-regex.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Edit with '#' by regex
Quick question , I have been trying to match any word containing a '#' from a string list and remove it, but I don't know how to handle it . been playing around on http://regexhero.net/tester/ trying but to no avail.
Essentially if it comes across #ff or wha#s up i will just regex.replace them.
any ideas on the Regular expression to use?.
Thanks.
I have a previous answer that covers some hashtag matching approaches.
In summary, if you are pulling statuses containing hashtags from Twitter, you no longer need to find them yourself. You can now specify the include_entities parameter to have Twitter automatically call out mentions, links, and hashtags (if the method you are calling, like statuses/show supports this parameter.
If you just need the regular expression to locate the hashtags and capture it's elements, Twitter provides it in an open source library that contains the following pattern.
(^|[^0-9A-Z&/]+)(#|\uFF03)([0-9A-Z_]*[A-Z_]+[a-z0-9_\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff]*)
More detail and additional links are provided in the original answer.
Related Articles
Need help editing a function (regex)
Combine two subsequent words with a regex?
Allow entry of money amounts into an entry with a Regex JavaScript
Work with GNU regex functions in C or C ++
Analyze a slash and apostrophe with Python regex
How to match a long with Java regex?
MULE ESB: Expression filter with the regex () function
Extract all substrings beginning and ending with a regex from a large string
Phone number format with jquery & regex done
Edit with IDLE is not available after installing Python 2.7 alongside Python 3.5. What should be done?
First occurrence of a word in a text with JavaScript Regex
Divide spaces with a regex only if they are not contained in a substring
Coming soon with a regex solution
How do I configure VIM so that files with .less extension are edited with a zen-encoding?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK