Visual Studio Find & Replace Regular Expression - Multiple Spaces Between Search Queries

I need a regular expression for the Visual Studio Find and Replace function , as shown below:

Find the following term: sectorkey in (

Between every three search terms there may be several spaces or even several line breaks / carriage returns.

The search query is looking for SQL statements, which are hard-coded values SectorKey inside the SQL statement in . They must be replaced by the SQL join statement - this will be done manually.

+3
source share
3 answers

The small arrow to the right of the Find field is your friend and can help you with the vagaries of MS regular expression syntax.

A new line is presented \n, so you can just do sectorkey( |\n)+in( |\n)+\((you need to avoid an open character in your search terms, as it is used in the group.)

+5
source

I believe that :Wh+is what you want. The experimental effect of Visual Studio is very strange; You will get better results if you refer to the official link . Examination with regular expressions "mainstream" tends to be more of a hindrance than help when it comes to VS.

+3
source

\s+ ( , CR, LF ..), , -, sectorkey\s+in\s+\(.

...

As Joe points out in his comment, Visual Studio doesn't seem to support \sFind / Replace expressions, in which case you probably have to use something like this [\n:b]. Then the regular expression will become sectorkey[\n:b]+in[\n:b]+\(.

+2
source

Source: https://habr.com/ru/post/1761201/


All Articles