xml - Regex for tagging UPPERCASE CAUTION data -


fellow forum members,

i'm using notepad++ , have bunch of cautions embedded within other text data. 2 constants set caution data apart rest of text data 2 factors. 1 caution text in uppercase text , second caution text starts word "caution" in uppercase. below small example of i'm descibing:

bla bla bla bla bla. caution not perform maintenance on machine without first reading owner's manual. bla bla bla bla bla bla.

is possible regex find many different variations of text below:

caution not perform maintenance on machine without first reading owner's manual.

and replace following:

 <caution><para>do not perform maintenance on machine without first reading owner's manual.</para></caution> 

i need coding regex following:

  1. is able target data starts word "caution" (in uppercase)
  2. is able target of uppercase text follows word "caution" until changes on lowercase text.
  3. deletes word "caution" located @ beginning after xml tag added.
  4. won't fooled uppercase "b" in word "bla" (i.e. "manual. bla"). in other words, doesn't include in find result first capital letter begins next sentence. how can greedy concern eliminated?

is such regex possible? how in world can regex made smart enough find caution related text based on have described? info appreciated. in advance.

i don't have notpad++ specifically, notwithstanding quirks in regex implementation, seems trick:

caution ([a-z](([^a-z])+\s+)+)  

with replacement of

<caution><para>$1</caution></para>  

see in action here:

http://regexr.com?35mku


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -