View Single Post
Old 09-05-2011, 03:57 AM   #5
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 74,072
Karma: 315558332
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
Quote:
Originally Posted by organized_chaos View Post
This works for single words, but how can I make it work with entire sentences? I'm sorry, I've never needed to edit documents like this before.
_([a-z ]+?)_

will work for words and spaces. If there might be punctuation involved, you could also add in those characters, e.g.

_([a-z ,.'"-;:]+?)_

or you could go for the slightly more chancy approach of

_([^_]+)_

which searches for an underscore, as many characters as possible that aren't an underscore, and then another underscore.
pdurrant is offline   Reply With Quote