Could anyone create Regex Search Code to check leading and trailing spaces? Thread poster: Nam Vo
|
Nam Vo Vietnam Local time: 10:22 English to Vietnamese + ...
I'm trying to create a checklist in Xbench to find leading/trailing space mismatch. I have tried things like [:space:]$, but the search function can only spot non-breaking spaces at the end of segments, not the kind of spaces created when you hit the space key. Help, please!
[Edited at 2019-10-05 03:07 GMT]
[Edited at 2019-10-05 05:05 GMT] | | |
Hello, Nam Vo! It is like this: ^[ ]|[ ]$ Between [ and ] are regular spaces Hope this helps. | | |
Nam Vo Vietnam Local time: 10:22 English to Vietnamese + ... TOPIC STARTER
Mikhail Zavidin wrote: Hello, Nam Vo! It is like this: ^[ ]|[ ]$ Between [ and ] are regular spaces Hope this helps. | | |
Nam Vo Vietnam Local time: 10:22 English to Vietnamese + ... TOPIC STARTER Hi Mikhail, I checked, but unfortunately your code didn't work. | Oct 5, 2019 |
Mikhail Zavidin wrote: Hello, Nam Vo! It is like this: ^[ ]|[ ]$ Between [ and ] are regular spaces Hope this helps. | |
|
|
Nam Vo Vietnam Local time: 10:22 English to Vietnamese + ... TOPIC STARTER
Hi Mikhail, I checked, but unfortunately your code doesn't work. You mean using it to search under Regular Expressions mode and not using Powersearch (Cltr+P), right? Unfortunately, it doesn't work. Could you kindly check, please!
[Edited at 2019-10-05 10:54 GMT] | | |
Search Mode combobox | Oct 5, 2019 |
Make sure you have Search Mode combobox set to Regular Expressions option. | | |
May be it is because I use the old (2.9) version of Xbench | Oct 5, 2019 |
It does not support Unicode characters. Which version do you use? | | |
Nam Vo Vietnam Local time: 10:22 English to Vietnamese + ... TOPIC STARTER I use version 3.0 | Oct 5, 2019 |
The latest version of Xbench actually have this check, but I would like to add this particular function to a checklist, in case my partners forget to check the built-in check option. | |
|
|
Well, my Xbench does not recognize starting and trailing spaces of the segment too | Oct 5, 2019 |
I am sorry for misleading you | | |
Nam Vo Vietnam Local time: 10:22 English to Vietnamese + ... TOPIC STARTER Thanks, Milkhail. | Oct 5, 2019 |
Yeah. No problem. This was supposed to be easy. Can't believe we can't mimic this function using a simple Regex code. | | |
Stepan Konev Russian Federation Local time: 06:22 English to Russian
you cannot do this task with Xbench. The regex suggested by Mikhail is ok, but Xbench cuts all the leading and trailing spaces even if they are there. If you try smth like [ ][.]$, it will give you all segments ending with space and full stop. This means that the regex itself is ok. However Xbench shows segments from their first 'visible' char to their last 'visible' char [with no spaces at the beginning/end]. Any CAT tool works the same way. Even if there are 3 spaces betwe... See more you cannot do this task with Xbench. The regex suggested by Mikhail is ok, but Xbench cuts all the leading and trailing spaces even if they are there. If you try smth like [ ][.]$, it will give you all segments ending with space and full stop. This means that the regex itself is ok. However Xbench shows segments from their first 'visible' char to their last 'visible' char [with no spaces at the beginning/end]. Any CAT tool works the same way. Even if there are 3 spaces between the sentences in your original file, you will see none. For example you have a text that goes like this: This is a simple text to test the leading and trailing spaces control.[ ][ ][ ]I want to know if Xbench can catch them with regex.[ ][ ][ ]Help me do this.[ ][ ][ ]Thank you. CAT/Xbench presentation wil be like this: Seg1 This is a simple text to test the leading and trailing spaces control. Seg2 I want to know if Xbench can catch them with regex. Seg3 Help me do this. Seg4 Thank you. Even if you have extra spaces deliberately inserted at the end of your target segments, Xbench will hide them for segmentation purposes. That is why you cannot find them with Mikhail's regex. No matter what version you use.
[Edited at 2019-10-07 04:42 GMT] ▲ Collapse | | |
pep Local time: 05:22 English to Spanish You need to select the "No Whitespace Trimming" check box | Oct 10, 2019 |
Nam Vo wrote: The latest version of Xbench actually have this check, but I would like to add this particular function to a checklist, in case my partners forget to check the built-in check option. With Xbench 3.0 build 1434 or later, to find leading or trailing spaces in segments via Search or via a checklist item, you need to select the No Whitespace Trimming checkbox in the Search Options or in the checklist item definition respectively. Otherwise the segment leading and trailing spaces will be considered to be trimmed in the source and target segments (as was the case with Xbench 3.0 builds before 1434). | |
|
|
Nam Vo Vietnam Local time: 10:22 English to Vietnamese + ... TOPIC STARTER Thank you very much, guys. | Oct 10, 2019 |
Thanks very much for your explanation, guys | | |