Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

223.Advanced search and replace -- How to change all numbers which have format of (number) to -number?

User: editor -- 2008-07-14          << 222  224 >>
Hits: 429
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How to change all numbers which have format of (number) to -number?
Input Sample:
123 225 (39) 32
(603.3) 222 333 555
Output Sample:
123 225 -39 32
-603.3 222 333 555
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open the text file
2. ctrl-h open 'Replace' dialog
in 'Replace' page:
* set 'Search for pattern' to:

* uncheck option [ ]Enhanced Regular expression
* set 'Replace with pattern' to:

3. Click 'Replace', done!

Note: 
1. \([\d\.\s]+\) is a regular expression, will match any number enclosed by a pair of parenthesis.

2. Use standard Regular Expression, so uncheck [ ]Enhanced Regular Expression

3. chars($match,2,-2) means remove the first char '(' and last char ')' from matched text.
Download Script:  scripts/223.rst.zip

Screenshot 1:  Replace_Window


Similar Examples:
How to change all numbers which have format of (number) to -number? (100%)
How to change all negative numbers to the format of (number)? (75%)
How to change all numbers in a text file to the comma separated numbers? (62%)
How to extract all numbers in a text file, and provide a summary of number at the end? (56%)
How to convert all numbers from decimal to percentage? (55%)
How to sort file by the number which first appear in each line? (53%)
How to change all numbers in a text file to 2 decimial places? (53%)
How to change text file format with user specified rules? (53%)

Check Demo of Advanced search and replace
Keywords:
parenthesis  how to change all numbers  nth  toc  last  numbers  las  regular expression  expression  format  regular expression change format  expression regular remove number  regular expression replace numbers  regular expression replace last  replace enclosed expression  enclosed replace regular expression  regular expression to remove first  replace regular format