Search code examples
regexadobe-brackets

How to linebreak in REGEX with brackets


I got a list of data like exactly like that

51.9499, 7.555780000000027; 51.49705, 9.389030000000048; 51.249182, 6.991165099999989; 47.3163508, 11.09513949999996; 51.33424979999999, 12.574196000000029; 50.0297493, 19.196331099999952; 47.8270212, 16.25014150000004; 

and I want to beautify it a bit by having linebreaks behind the "; " so it would rather look like

51.9499, 7.555780000000027; 
51.49705, 9.389030000000048; 
51.249182, 6.991165099999989; 
...

I am using Adobe Brackets and I am trying to put a hard linebreak into the replace dialogue but that doesn't work - what would instead work?


Solution

  • In the replace bar, click on the .* icon to change the replace method to regular expression.

    Then you can use ;\s* replace with ;\n to beautify your code accordingly.

    You can see an example of this regex being run here.

    Outputs the following:

    51.9499, 7.555780000000027;
    51.49705, 9.389030000000048;
    51.249182, 6.991165099999989;
    47.3163508, 11.09513949999996;
    51.33424979999999, 12.574196000000029;
    50.0297493, 19.196331099999952;
    47.8270212, 16.25014150000004;