Artikash / Textractor

Extracts text from video games and visual novels. Highly extensible.
GNU General Public License v3.0
2k stars 201 forks source link

Regex code that deletes the word after a particular word #1187

Closed iiuuoow closed 8 months ago

iiuuoow commented 8 months ago

I want to delete all the words ォ follow. But in some situations, ォ is necessary, So I want to delete the words that follow these.

?ォ 。ォ !ォ )ォ

EXAMPLE: を連れて少し出てくるよ。ォ4キいてみるしかない > を連れて少し出てくるよ。 (話を聞いてみるしかない)ォN > (話を聞いてみるしかない)

Please help me make these REGEX CODE.

Blu3train commented 8 months ago

So you want this result? を連れて少し出てくるよ。ォ

iiuuoow commented 8 months ago

So you want this result? を連れて少し出てくるよ。ォ

No, the ォ wants a missing string. Like that. を連れて少し出てくるよ。

Blu3train commented 8 months ago

Please, write the result of your example EXAMPLE: を連れて少し出てくるよ。ォ4キいてみるしかない > を連れて少し出てくるよ。 (話を聞いてみるしかない)ォN > (話を聞いてみるしかない) maybe this? を連れて少し出てくるよ。キいてみるしかない > を連れて少し出てくるよ。​ (話を聞いてみるしかない) > (話を聞いてみるしかない)

iiuuoow commented 8 months ago

All of the sentences that follow along with the ォ should be removed. Example: を連れて少し出てくるよ。ォ4キいてみるしかない を連れて少し出てくるよ。

(話を聞いてみるしかない)ォN (話を聞いてみるしかない)

Blu3train commented 8 months ago

try this |REGEX|(?|。|!|))ォ.+$|BECOMES|$1|MODIFIER|g|END|

iiuuoow commented 8 months ago

Does it work even if I wear it like this? .replace(/(?|。|!|))ォ.+$/g,'')

Blu3train commented 8 months ago

.replace(/(?|。|!|))ォ.+$/g,'$1')

iiuuoow commented 8 months ago

Thank you. This didn't apply, but I solved it using the ([ォ]) [^ォ]* you told me before. Thank you always!