Find all . between the start of the line and the first occurence : and find all " " between the start of the line and the first occurence :
-
Hi,
Here is the data I currently have (“before” data):
tokenized files: "toto.properties" spring.flyway.tata: "classpath:/xxxx/oracle" spring.flyway.toto: "classpath:/xxxx/oracle" spring.flyway.tata: "EN" spring.flyway.schemas: "OWNEN" spring.flyway.titi.aper: "APLEN" spring.flyway.titi.aplr: "AP" spring.flyway.titi.user: "APL" db.url: "jdbc:oracle:thin:@.fr.pop.intra:12232/1"
Here is how I would like that data to look (“after” data):
I have two needs 1-> i would like to find all . between the start of the line and the first occurence ":" 2->i would like to find all " " between the start of the line and the first occurence ":"
So the result shoule be this way
To accomplish this, I have tried using the following Find/Replace expressions and settings
(?:^|\G(?!^))[^.]\K.(?=.?: )
The problem is notepad++ give me also this result
Could you please help me to find the right expression?
Thank in advance
-
Hello, @long-manith-srey and All,
From your post, we can merge your two needs, saying :
From start of any line, I would like to find all
space
anddot
characters which come before the first occurrence of the:
symbolIf so, I think that the following regex does the expected job !
-
Move to or open your file
-
If necessary, move to its very beginning with the
Ctrl + Home
shortcut ( IMPORTANT because of the negative look-ahead(?!\A)
) -
Open the Find or Mark dialog (
Ctrl + F
/Ctrl + M
) -
SEARCH or MARK
(?-s)(^|(?!\A)\G)[^:\r\n]+?\K[ .]
-
Untick all options
-
Select the
Regular expression
search mode -
Click on the
Find All in Current Document
or on theMark All
button
Of course, we’ll be able, to tune this regex, next time, in order to prevent from some matches or to get some additional matches, if any !
On the other hand, the FR regex
[ .]
could be expressed differently if you need replacement and separate characters for thespace
anddot
chars !Best Regards
guy038
P.S. :
Using the notation from this generic regex, we have :
BSR =
^
ESR =
[^:\r\n]
. Note that we could have used the((?!:).)+?
syntax, instead, but the former syntax is more simple !FR =
[ .]
So the alternate regex is
(?-s)(^|(?!\A)\G)((?!:).)+?\K[ .]
-
-
@guy038
Thank you so much*It’s perfect :)