locating non-zero values
Posted: Mon Nov 16, 2009 7:50 pm
A question for ben_josephs or Bob Hansen:
This is the test string (with spaces):
0 0 0 0 0 0 0 0 0 0 0 0%lf% 0 0 0 0 0 0 0 0 0 0 0 0%lf% 0 0 0 0 0 0 0 0 34 34 34 0 0 0%lf% 0 0 0 0 0 0 0 0 0 0 0 0%lf%
The task is to locate the non-zero values. I am using "_" for space char in Search/Replace strings.
This does work, ends up with 0 xxx xxx xxx 0 where I expect it.
Search for: [^0_][1-9]_
Replace with: xxx_
This does not work, ends up with 0 xxx 34 xxx 0 in the same area
Search for: _[^0 ][1-9]_
Replace with: _xxx_
If I single step througn current document, this last expression works OK, but if I do a mass update through Selected Text, it fails as shown above. The only difference is the leading space chars.
Can you please provide an explanation about the non-working syntax?
I still have some unknowns about the non-zero values, I do not know how many digits are valid, and I don't know if two or more digits would have leading zeros so that two digits seven is either "7" or "07"
This is the test string (with spaces):
0 0 0 0 0 0 0 0 0 0 0 0%lf% 0 0 0 0 0 0 0 0 0 0 0 0%lf% 0 0 0 0 0 0 0 0 34 34 34 0 0 0%lf% 0 0 0 0 0 0 0 0 0 0 0 0%lf%
The task is to locate the non-zero values. I am using "_" for space char in Search/Replace strings.
This does work, ends up with 0 xxx xxx xxx 0 where I expect it.
Search for: [^0_][1-9]_
Replace with: xxx_
This does not work, ends up with 0 xxx 34 xxx 0 in the same area
Search for: _[^0 ][1-9]_
Replace with: _xxx_
If I single step througn current document, this last expression works OK, but if I do a mass update through Selected Text, it fails as shown above. The only difference is the leading space chars.
Can you please provide an explanation about the non-working syntax?
I still have some unknowns about the non-zero values, I do not know how many digits are valid, and I don't know if two or more digits would have leading zeros so that two digits seven is either "7" or "07"