Git Product home page Git Product logo

Comments (10)

Blu3train avatar Blu3train commented on July 29, 2024

Preserving multiple lines is complicated. Is a single line result OK?
Like this
張世平【チョウセイヘイ】「にんげん?食い止めるんだ!」

from textractor.

Blu3train avatar Blu3train commented on July 29, 2024

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|

from textractor.

iiuuoow avatar iiuuoow commented on July 29, 2024

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);

from textractor.

Blu3train avatar Blu3train commented on July 29, 2024

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;

from textractor.

iiuuoow avatar iiuuoow commented on July 29, 2024

Then, is it right if I write it like this?

|REGEX|(([^」]|\n)+」)((.|\n)+)|BECOMES|$3\r$1
$1|MODIFIER||END|

from textractor.

Blu3train avatar Blu3train commented on July 29, 2024

No, this

---start here
|REGEX|(([^」]|\n)+」)((.|\n)+)|BECOMES|$3
$1|MODIFIER||END|
---end here

from textractor.

iiuuoow avatar iiuuoow commented on July 29, 2024

Thank you!
However, test results are same,,

results :
「わかった。すぐに向かうわ」
関羽

from textractor.

iiuuoow avatar iiuuoow commented on July 29, 2024

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);

from textractor.

Blu3train avatar Blu3train commented on July 29, 2024

maybe like this
s.replace(/(([^」]|\n)+」)((.|\n)+)/g, '$3\n$1');

from textractor.

iiuuoow avatar iiuuoow commented on July 29, 2024

Thank you for your efforts!!

from textractor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.