notepad++ reg expressions to swap two values

前端 未结 4 1891
你的背包
你的背包 2020-12-18 10:02

i\'m trying to swap latitude and longitude values in notepad++ with regular expressions. i tried to search some guide on the web but i didn\'t understand how to do. i have a

相关标签:
4条回答
  • 2020-12-18 10:43

    Make sure you place the cursor at the beginning of the file.

    1. Hit CTRL+H.
    2. Choose the Replace tab.
    3. Select Regular Expression at the bottom.

      Find: ([\d.]+),([\d.]+)
      Replace: \2,\1

    0 讨论(0)
  • 2020-12-18 10:49

    find what:

    ^([0-9]*\.[0-9]*),([0-9]*\.[0-9]*)$
    

    replace with:

    \2,\1
    

    also, search mode should be set to regular expression

    edit: escaped . as suggested in comments.

    0 讨论(0)
  • 2020-12-18 10:52

    Try with following regex:

    (\d+\.\d+),(\d+\.\d+)
    

    and replace it with:

    \2,\1
    
    0 讨论(0)
  • 2020-12-18 10:54

    Search for:

    ([0-9]+(\.[0-9]+)?),([0-9]+(\.[0-9]+)?)
    

    Replace with:

    \2,\1
    

    This catches numbers like 1, 1.1 but not 1. or .5. My previous regexp ([0-9]+.?[0-9]*),([0-9]+.?[0-9]*) would allow for 1..

    0 讨论(0)
提交回复
热议问题