Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using Regex to replace #2864

Closed
OmrSi opened this issue Apr 3, 2018 · 14 comments
Closed

Error when using Regex to replace #2864

OmrSi opened this issue Apr 3, 2018 · 14 comments

Comments

@OmrSi
Copy link
Member

OmrSi commented Apr 3, 2018

when i try using regex to add a tag to the start of every line, i replace every "^" with "{\fs50}", but the program stops and i have to close it from task manager

@mkver
Copy link
Contributor

mkver commented Apr 3, 2018

You did it by using "Replace" (Ctrl+H) and the "Replace all" button therein and not using the "Multiple replace" (Ctrl+Alt+M) tool, didn't you? It seems that in this mode the cursor is not always put to the right of what was just inserted; in particular this happens with zero-width matches like yours. Therefore it always starts again at the beginning of the line and adds your tag until SE ends (by using the task manager or probably until your system runs out of RAM). But it also happens with non-zero-width matches. My first guess was that it actually just doesn't change its index (the cursor position) in the given string. But during testing I also noticed another odd thing with replace: It sometimes does it more often than it should. If I search for A in the input string "ABCAA" and want to replace it (once!) with nothing (""), the result is "BC", not "BCAA".
You should use multiple replace for this until this gets fixed. It works fine.

@OmrSi
Copy link
Member Author

OmrSi commented Apr 4, 2018

Good to know. And Yes, I did understand some of it. 😅
Hope he can fix it.

@niksedk niksedk closed this as completed in 3b63895 Apr 5, 2018
@niksedk
Copy link
Member

niksedk commented Apr 5, 2018

I've tried to fix the issue in latest beta: https://github.com/SubtitleEdit/subtitleedit/releases/download/3.5.6/SubtitleEditBeta.zip
How does that work for you?

niksedk added a commit that referenced this issue Apr 5, 2018
@niksedk
Copy link
Member

niksedk commented Apr 5, 2018

Beta updated again with minor fix...

@OmrSi
Copy link
Member Author

OmrSi commented Apr 5, 2018

Works well.
but if I use it while on translator's mode, it stops again.
I think this is more related to #2839

@OmrSi
Copy link
Member Author

OmrSi commented Apr 5, 2018

Thx. :)

@niksedk niksedk reopened this Apr 5, 2018
niksedk added a commit that referenced this issue Apr 5, 2018
@niksedk
Copy link
Member

niksedk commented Apr 5, 2018

Beta updated with hopefully improved functionality regarding translator mode: https://github.com/SubtitleEdit/subtitleedit/releases/download/3.5.6/SubtitleEditBeta.zip

@OmrSi
Copy link
Member Author

OmrSi commented Apr 5, 2018

One problem.
Now if you choose to start from the top, the replacement will occur twice for the lines after and once for the lines before.
If I'm at line 16 it will replace lines 16 to last and when accepting to start from the top, it will happen again for lines after 16.

@niksedk
Copy link
Member

niksedk commented Apr 5, 2018

@OmrSi: Could you explain in more detail?

@OmrSi
Copy link
Member Author

OmrSi commented Apr 5, 2018

I'm at line 16, I press replace all, and the program replaces everything from line 16 to the end, then it asks if it want to start from the beginning of the document, if I press yes, it replace everything from line 1 to the end, so lines 16 to end are replaced again.

niksedk added a commit that referenced this issue Apr 6, 2018
@niksedk
Copy link
Member

niksedk commented Apr 6, 2018

@OmrSi: thx, beta updated: https://github.com/SubtitleEdit/subtitleedit/releases/download/3.5.6/SubtitleEditBeta.zip

@OmrSi
Copy link
Member Author

OmrSi commented Apr 6, 2018

Nope. Check it out.
I replaced "^" with "3" from the marked line.
screenshot 323

niksedk added a commit that referenced this issue Apr 6, 2018
@niksedk
Copy link
Member

niksedk commented Apr 6, 2018

I've tried to fix the issue yet again: https://github.com/SubtitleEdit/subtitleedit/releases/download/3.5.6/SubtitleEditBeta.zip
How does it look now?

@OmrSi
Copy link
Member Author

OmrSi commented Apr 6, 2018

All Good Now. 😄
Thank You.

@OmrSi OmrSi closed this as completed Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants