Java Regex To Match List Of KeyWords- Non Greedy -


i have working java regex except, given logic, greedy.

the intention match 4 words including keyword , not spaces or words or characters before or after.

sample text:

  chief complaint      · "lorem ipsum dolor sit amet.."      · "lorem ipsum dolor sit amet.."       history of present illness      lorem ipsum dummy text of printing , typesetting      review of systems      donec luctus metus: lorem ipsum dummy text of printing , typesetting industry.     donec luctus metus: lorem ipsum dummy text of printing , typesetting industry.      past medical history      · contrary popular belief, lorem ipsum not random text      · contrary popular belief, lorem ipsum not random text      social history      · "lorem ipsum dolor sit amet.."      · "lorem ipsum dolor sit amet.."      surgical history      · "lorem ipsum dolor sit amet.."      family history      · "lorem ipsum dolor sit amet.."      current meds      · "lorem ipsum dolor sit amet.." 

my regex:

^[\s]*(?:\b(?:[ss]ubjective|[oo]bjective|[aa]llergy|[ll]aboratory|[ll]ab|[aa]llergie|[ii]mpression|[pp]lan|[hh]istory|[mm]ed|[ee]xam|[vv]ital|[aa]ssessment|[pp]roblem|[cc]omplaint|[ii]llness|[ss]ystems|list|[cc]hief|of|[cc]urrent|[pp]resent|[ii]llness|[pp]ast|[mm]edica|[a-za-z]|comment:)+s?\b[\s]*){1,4}$ 

online tester link:

http://java-regex-tester.appspot.com/regex/85b4429f-59ed-4a0c-b016-f7a6ddce5344

can please suggest edit ?

it looks text formatted consistently. why don't this?

^\s{7,8}([^ ].*)$ 

which captures have 7 or @ 8 leading spaces.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -