Open iiuuoow opened 5 months ago
Preserving multiple lines is complicated. Is a single line result OK? Like this 張世平【チョウセイヘイ】「にんげん?食い止めるんだ!」
In the regex file you have to put the carriage return as written here, between $3 and $1
|REGEX|(([^」]|\n)+」)((.|\n)+)|BECOMES|$3
$1|MODIFIER||END|
Thank you! I want to apply it in JavaScript, is it like this?
const regex = /(([^」]|\n)+」)((.|\n)+)/; const input = 'YourInputStringHere';
const result = input.replace(regex, (match, group1, group2, group3) => { return group3; });
console.log(result);
I don't know, but surely in the return you must also add group1 in addition to group3
If you want to keep the carriage return 'maybe' like this
return group3+'\n'+group1;
Then, is it right if I write it like this?
|REGEX|(([^」]|\n)+」)((.|\n)+)|BECOMES|$3\r$1 $1|MODIFIER||END|
No, this
---start here
|REGEX|(([^」]|\n)+」)((.|\n)+)|BECOMES|$3
$1|MODIFIER||END|
---end here
Thank you! However, test results are same,,
results : 「わかった。すぐに向かうわ」 関羽
Thank you! However, test results are strange,,Maybe my JavaScript is the problem
results :
onEnter onEnter: 0 「関羽……」 onEnter onEnter: 0 劉備【リュウビ】 「関羽……」 劉備【リュウビ】
JavaScript const regexPattern = /(([^」\n]+)」)((.|[\n])+)/g;
let match; while ((match = regexPattern.exec(s)) !== null) { const modifiedString = match[3] + match[1]; s = s.replace(match[0], modifiedString); }
console.log(s);
maybe like this
s.replace(/(([^」]|\n)+」)((.|\n)+)/g, '$3\n$1');
Thank you for your efforts!!
The name is displayed at the back. I want to modify this to a regex filters.
original: 「にんげん? 食い止めるんだ!」 張世平【チョウセイヘイ】
want result: 張世平【チョウセイヘイ】 「にんげん? 食い止めるんだ!」
Maybe, It need 2 filters.