cannot replace when regex in find field

Hi there,

I have a lot of this in my target:

620x260x440mm (24.4 x10.2x17.3in)

Some have no space others have U00A0, U2000 or what so ever following the numbers. I would like to replace all instances of number + unit/x with number+U202F+unit/x.

So I press Ctrl+H and I enter the following expression into the find field:

( ? < = \\ d ) \\ p {Zs}* ( ? = [xmi] )


I check the case sensitive and regex boxes and find nicely all I want.

Now the promblem: I cannot replace it with my U202F nor with anything else. Whenever there is a regex in the find field, the replace field seems not to work anymore.

Why is that? Ideas anybody?
I use Studio 2015 Freelance and the source is a docx, that I got as a package.

Thanks in advance!
Uta

PS: I posted this question already in ProZ, but no one answered...

Parents Reply Children
  • I tried to do it with backreferences. That is also kind of buggy: I used this in the find field:
    ( \ p {Zs} * x \ p {Zs} * ) and
    °$1°
    in the replace field (° means u202F).

    It matches everything correctly. But it only adds the spaces to the x. So if there are already any kind of spaces around the x, they get doubled. Or is it my regex?
  • About your first regex, it's the same with my Studio 2014: Studio matches but can't replace even if the Replace with field is as simple as foo. (BTW: there are extra espaces and \ in your regex).

    About your second regex, I'd say it's the expected behaviour, nothing buggy here.

    Maybe you can divide the solution in 2 regexes:

    (1/2) This regex will match the X'es:

    Find what: (\p{Zs}*)(x)(\p{Zs}*)

    Replace with: °$2°

    where ° is the non-breakable space

    (2/2) This regex will match the in's and mm's

    Find what: (\d)(\p{Zs}*)([mi])

    or

    Find what: (\d)(\p{Zs}*)(mm|in)

    Replace with: $1°$3

    where ° is the non-breakable space

    Anyway, I'd recommend you too the Regex Match Solution Provider (find it here: http://appstore.sdl.com/app/regex-match-autosuggest-provider/412/): You would be able to translate on the fly (which is easier and automatic), not replacing after translation.

    Hope it helps.

    ... Jesús Prieto ...