regex in find replace
Posted: Fri Apr 21, 2017 11:42 am
Dear all,
I have a file where I need to replace some information with tags using regex in the find replace dialogue. I am not able to get the regex however...
The text is like this.
I need to match all what follows A) and all what follows B). in regexer I found that this expression works fine
the second
I tried to convert it to the required regex dialect for oXygen, but without success.
I have changed [A-Z] to \p{Upper} as indicated in another forum post and added (?s) to make the match not greedy and restricted the path to the sense element.
as first match
and second match
I do not understand where is my mistake. I have tried changing the greediness without success.
thanks a lot for any advise or help on how to make this work!
I have a file where I need to replace some information with tags using regex in the find replace dialogue. I am not able to get the regex however...
The text is like this.
Code: Select all
<sense>pron. rel. et conj. rel. (gramm. § 147; gramm. § 169,5).
A) Pron. rel.: Sing. m. ዘ፡, fem. እንተ፡, Pl. c. እለ፡ <i>qui</i>, <i>quae</i>,
<i>quod</i>. 1) De constructione hujus pronominis B) Sx. Sen. 7 Enc.
</sense>
the first match is((\s)([A-Z])(\))(\s))(.*?)(?=((\s)([A-Z])(\)(\s))|$))
Code: Select all
A) Pron. rel.: Sing. m. ዘ፡, fem. እንተ፡, Pl. c. እለ፡ <i>qui</i>, <i>quae</i>,
<i>quod</i>. 1) De constructione hujus pronominis
Code: Select all
B) Sx. Sen. 7 Enc.
I have changed [A-Z] to \p{Upper} as indicated in another forum post and added (?s) to make the match not greedy and restricted the path to the sense element.
nevertheless this does not work, and I get only((\s)(\p{Upper})(\))(\s))((?s).*?)(?=((\s)(\p{Upper})(\)(\s))|$))
as first match
Code: Select all
A) Pron. rel.: Sing. m. ዘ፡, fem. እንተ፡, Pl. c. እለ፡ <i>qui</i>, <i>quae</i>,
Code: Select all
B) Sx. Sen. 7 Enc.
or((\s)(\p{Upper})(\))(\s))((?s).*)(?=((\s)(\p{Upper})(\)(\s))|$))
both return one match only((\s)(\p{Upper})(\))(\s))(.*?)(?=((\s)(\p{Upper})(\)(\s))|$))
Code: Select all
A) Pron. rel.: Sing. m. ዘ፡, fem. እንተ፡, Pl. c. እለ፡ <i>qui</i>, <i>quae</i>,
<i>quod</i>. 1) De constructione hujus pronominis B) Sx. Sen. 7 Enc.