1

I'm reasonably new to Notepad++ and regular expressions, I'm really struggling to solve this issue

0:6[105][56]
0:6[105][55]
0:6[105][54]
0:6[104][53]

?:?[??][??] -> where numbers can be anything

I've tried using the Find:

  • Find (:)|(])
  • Replace (][)|(->connectedwaypoints.push_back)

This doesn't seem to work

below is my desired result.

WarpPoints[0]->paths_connected[6]->connectedwaypoints.push_back(HiFiWaypoints[105][56]);


WarpPoints[?]->paths_connected[?]->connectedwaypoints.push_back(HiFiWaypoints[?][?]);

? can be any given number, I want to not replace the numbers, but everything else.

  • @McDonald's my expected format / outcome is WarpPoints[0]->paths_connected[6]->connectedwaypoints.push_back(HiFiWaypoints[105][56]); – RNewell122 Aug 29 '17 at 2:00
  • @McDonald's Thats ok, do you have any idea how ? – RNewell122 Aug 29 '17 at 4:31
1

Try to find:

([0-9]):([0-9])(\[[0-9]+\]\[[0-9]+\])

And replace with

WarpPoints[\1]->paths_connected[\2]->connectedwaypoints.push_back\(HiFiWaypoints\3\)\;

And the search mode should be "Regular expression".

Explained:

  • For the find part, [0-9] means any digits, \[ and \] means to match any [ and ] respectively. ( and ) will make anything inside the parenthesis referred in "replace with " as \1 \2 etc.

  • For the replace with part, it is pretty self-explanatory, where \1 is the contents within the first pair of parenthesis, \2 being the contents within the second pair, etc.

Please Google on "regular expression" if you are not sure what the other symbols means.

  • That worked thanks! I was trying to do it bit by bit, and was taking a long time forgot \ is often used in many languages to [ use symbols, thats where I was going wrong. – RNewell122 Aug 29 '17 at 6:16

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.