looking for a regular expression

¨ì©³¦b²Ö¤°»ò°Ú¡H shadowcaster.bbs at bbs.wretch.cc
Tue Aug 1 09:38:04 EDT 2006


I want words between 2 nearby commas with a specific word in them.

For example,in the text blow:

"We the people of the United States, in order to form a more perfect union,
establish justice, insure domestic tranquility,......"

I want "justice" and the words between the 2 nearest commas, which is

 establish justice

All I can come up with is

  r",(.*?justice.*?),"

but the result is

   in order to form a more perfect union, establish justice

Apreciate any help.
--
夫兵者不祥之器物或惡之故有道者不處君子居則貴左用兵則貴右兵者不祥之器非君子
之器不得已而用之恬淡為上勝而不美而美之者是樂殺人夫樂殺人者則不可得志於天下
矣吉事尚左凶事尚右偏將軍居左上將軍居右言以喪禮處之殺人之眾以哀悲泣之戰勝以
喪禮處之道常無名樸雖小天下莫能臣侯王若能守之萬物將自賓天地相合以降甘露民莫
之令而自均始制有名名亦既有夫亦將知 210-64-83-81.adsl.dynamic.seed.net.tw海
作者在 06/08/01 21:35:48 從 210-64-83-81.adsl.dynamic.seed.net.tw 修改這篇文章
作者在 06/08/01 21:36:28 從 210-64-83-81.adsl.dynamic.seed.net.tw 修改這篇文章
作者在 06/08/01 21:37:08 從 210-64-83-81.adsl.dynamic.seed.net.tw 修改這篇文章
作者在 06/08/01 21:38:04 從 210-64-83-81.adsl.dynamic.seed.net.tw 修改這篇文章



More information about the Python-list mailing list