Search and replace does not work
Thread poster: Anna Sarah Krämer Fazendeiro

Anna Sarah Krämer Fazendeiro
Germany
Local time: 23:46
Member (2011)
English to German
+ ...
Mar 18, 2016

I am trying to replace values that have a space between number and unit with their spaceless counterparts (e.g. 430 PS, 60 km/h and 30 mm with 430PS, 60km/h, 30mm).

Using " PS" and "PS" in Search and Replace does not work - it will replace one or two of the terms and then claim there are no more, even though there are very clearly plenty more. Same with "430 PS" and "430PS". Searching it as a whole word or not makes no difference.

I would be thankful if anyone has an idea what might be going on here and how I could solve that.

What would I have to do to search an arbitrary number with regex? Maybe that would work.


 

Sandra& Kenneth  Identity Verified
Israel
Local time: 00:46
Member (2009)
French to English
+ ...
Why? Mar 18, 2016

AFAIK, there should be a space between number and unit:

Space (punctuation) - Wikipedia, the free encyclopedia
https://en.wikipedia.org/wiki/Space_(punctuation)
Jump to Spaces and unit symbols - [edit]. The International System of Units (SI) recommends inserting a space between a number and a unit of ...

SI Unit rules and style conventions
There is a space between the numerical value and unit symbol, even when the value is used in an adjectival sense, except in the case of superscript units for plane angle.
proper: a 25 kg sphere

SI Unit rules and style conventions checklist - http://is.gd/GElkIC

etc.

icon_smile.gif
Sandra


 

Anna Sarah Krämer Fazendeiro
Germany
Local time: 23:46
Member (2011)
English to German
+ ...
TOPIC STARTER
Client wants it so Mar 18, 2016

That is what I told the client - but they want to have this without spaces and indeed the requirement is also specified in the style guide of the client. I will have to go through the document and remove the spaces, even though it hurts... icon_razz.gif

 

Ricki Farn
Germany
Local time: 23:46
Member (2005)
English to German
Regex Mar 18, 2016

The regular expression is "[0-9] " (without the quotation marks), but you can't use a regex for the replace string, you can only use it as the search string (to make sure you haven't overlooked any strings while manually replacing).

Frustrating ...

Depending on the length of the text, doing ten individual "replace all" steps (for each of the numbers 0 to 9) without regex might still be faster than a manual replace process.

Also, make sure you're searching for "hard" (unbreakable) blanks as well if you might have used them.


 

Stepan Konev  Identity Verified
Russian Federation
Local time: 00:46
English to Russian
Regex replace works with TS2015 Mar 18, 2016

However I experienced the same problem. Reaplace all command only replaces a portion of hits, and you need to press Replace all several times before you can really replace all.
I thought replacing in regex mode caused this, but now I see this may also happen with normal text replacement.


 

Florian Betz
Germany
Local time: 23:46
English to German
+ ...
try "find" once, then "replace all" Mar 19, 2016

In the 2011 version you have to use either "find" or "replace" once, before the "replace all" button has any effect.
In other words, you have to make sure the first instance of your search term has been "found" by the dialogue.

I was never quite sure if this is some sort of safeguard against accidentally replacing all, or simply a bug.

As far as regexp goes, I'd suggest something like this, provided Stepan is right:

find ([0-9]) ([a-z])
replace with \1\2
note that match case has to be off for this one, otherwise "[a-z]" will catch lowercase letters only.


 

Stepan Konev  Identity Verified
Russian Federation
Local time: 00:46
English to Russian
Yeah, I observed this too... Mar 19, 2016

I found out that when you first use Find and then Replace all, it looks like it works. It replaces many hits but not all.
In addition, when you replace using regex, you cannot undo it.
Thus, you have to press Find once, then Replace all three or four times, and finally you cannot undo these operations.


 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

Search and replace does not work

Advanced search







Déjà Vu X3
Try it, Love it

Find out why Déjà Vu is today the most flexible, customizable and user-friendly tool on the market. See the brand new features in action: *Completely redesigned user interface *Live Preview *Inline spell checking *Inline

More info »
WordFinder Unlimited
For clarity and excellence

WordFinder is the leading dictionary service that gives you the words you want anywhere, anytime. Access 260+ dictionaries from the world's leading dictionary publishers in virtually any device. Find the right word anywhere, anytime - online or offline.

More info »



Forums
  • All of ProZ.com
  • Term search
  • Jobs
  • Forums
  • Multiple search