0

I have a file full of lines like this:

<td>123.456</td>

that I want to convert to:

<td class="num">123.456</td>

I tried using the advanced find/replace (with regular expressions enabled):

find: <td>([0-9\.]+)</td>
replace: <td class="num">\1</td>

I can find my td elements fine, but somehow replace gets me an empty TD:

<td class="num"></td>

What am I doing wrong?

  • It works fine for me... – djeidot Jul 23 '10 at 18:06
  • Works fine for me too. – boot13 Jul 24 '10 at 4:43
0

I've not used Notepad++ myself all that much, but you might check to make sure \1 is the correct... syntax? to use. For example, Dreamweaver uses %1 instead.

| improve this answer | |
0

It looks like it's a bug with Notepad++ or one if its plugins.

Switching the language from HTML to normal text fixed this for me.

| improve this answer | |
-1

This doesn't look like a bug to me. I know this post is a few months old, but humor me.

In your find line: find: ([0-9.]+)

It looks like you only told the engine to find one numeral before the period repeated one or more times. Shouldn't your regex look more like this.

find: ([0-9]+.[0-9]+)

Correct me if I'm wrong.

| improve this answer | |
  • 2
    You are wrong. :-) ([0-9.]+) matches 1 or more decimals or periods. Thus, it matches 049.0234.493 and 3059 and .... What you described sounds like ([0-9]+\.)+ – Thanatos Nov 2 '10 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.