Wildcard in replace field
-
@Alan-Kilborn said in Wildcard in replace field:
@guy038 said in Wildcard in replace field:
Where did you see that the N++ regex engine migrates from Boost v1.55.0 to Boost v1.70.0 ?!
Well, the build instructions for Notepad++ mention Boost 1.70…
It’s also mentioned in here:
https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/scintilla/boostregex/BoostRegExSearch.cxx#L1-L10Ah, okay, @xylographe made https://github.com/notepad-plus-plus/npp-usermanual/issues/47, which came as a result of BUILD.md.
It would be nice if maybe the Debug Info for Notepad++ included both the Scintilla and Boost version numbers it uses?
That would be nice. But unfortunately, none of us can be the one to put in the issue, otherwise it is likely to be ignored.
-
@PeterJones said in Wildcard in replace field:
That would be nice.
It would probably also be something a dev would have to remember to do by hand when it changes, instead of being automated, so it might be a poor idea anyway (I don’t trust the hoomans to remember to update these types of things).
-
Hi, @alan-kilborn, @peterjones, @ekopalypse, and All,
Alan and Peter, thank you so much for these clarifications ;-)
Although the last Boost regex
1.7.3
version is not used and that Notepad++ is build with Boostv1.7.0
since N++v7.8.0
, the differences between the search regex documentation of Boost versionsv1.5.5
andv1.7.0
, mentioned in my previous post, are identical and are still valid ;-))
So, the good news is that our new regex library does support the
Perl
’s backtracking control verbs. Woooow !! I’m quite eager to investigate this new side of regular expressions:-)) I will keep you informed of the interest of these new functions and will try to provide you with relevant examples for a better understanding…As a result, I have also updated the FAQ contents !
Now, while browsing the Boost C++ libraries website, I came across a thorny problem : when we speak of Boost
v1.70.0
, I think that it’s an abuse of language ! Because the strings1.55.0
and1.70.0
refer to a documentation version and NOT to a library version :-( Indeed :-
Formerly, we were using the Boost-Regex library from the Boost
-1.54.0
version of the Boost C++ libraries and we referred to its Boost1.55.0
library documentation -
Since Notepad
v7.7
, we’re using the Boost-Regex-5.1.3
library from the Boost-1.64.0
version of the Boost C++ libraries and we refer to its Boost1.70.0
library documentation
Refer to all these links, below. It’s a bit tricky !? Compare the different links, two by two
https://www.boost.org/doc/libs/1_55_0/
https://www.boost.org/doc/libs/1_70_0/
https://www.boost.org/doc/libs/1_55_0/libs/regex/doc/html/index.html
https://www.boost.org/doc/libs/1_70_0/libs/regex/doc/html/index.html
https://www.boost.org/doc/libs/1_70_0/libs/regex/doc/html/boost_regex/background/history.html
Could you confirm my guesses ? TIA !
Cheers,
guy038
P.S :
The last version uses the Boost-Regex
-5.1.4
library from the Boost-1.72.0
version of the Boost C++ libraries and refers to the Boost1.73.0
library documentationSee :
https://www.boost.org/doc/libs/1_73_0/
https://www.boost.org/doc/libs/1_73_0/libs/regex/doc/html/index.html
https://www.boost.org/doc/libs/1_73_0/libs/regex/doc/html/boost_regex/background/history.html
-
-
A big thank you to everyone who replied to my question offering help. @Alan-Kilborn’s suggestion seems to work perfectly.
All the best to this great community!
-Dax. -
Hey all!
I have no idea why, but for some reason, this solution has stopped working…
Seriosuly, I have no idea what’s going on, but (\d\d:\d\d):(?=\d\d) no longer finds a string of text that looks like 0:10:02 using RegEx.Is it possible a recent update to NPP might have broken this or changed syntax??
I’m so confused.Thanks in advance!
-Dax. -
Hi @daxliniere
The quoted regex matches strings with two leading numbers, as “00:12:12”.
In order to match strings with only one leading number, just remove a “\d” from the expression, as(\d:\d\d):(?=\d\d)
.Have fun!
-
@astrosofista Thank you so very much!! It works exactly as before.
I have no clue what could have changed, but this has solved the problem.I really appreciate your time on this. I was in the middle of a job and got stuck on this. Was comtemplating manual correction of ~400 lines!
Have a great weekend. :)
-Dax. -
AHHH!!! I understand it now!
The data I had been receiving previously had trailing zeros so every line had xx:xx:xx formatting. It seems whoever was typing this started dropping the trailing zeros.
Is there a more robust form of(\d:\d\d):(?=\d\d)
needed? -
You say “trailing”, but the regex shown (as modified by @astrosofista) has removed the requirement for leading zeros. To make it match both, I’d do
(\d{1,2}:\d\d):(?=\d\d)
, which will match whether there is one digit or two.But if you give an example of “with” or “without” “trailing zeros”, we can be more confident of what you’re really asking for.
-
@PeterJones
instead:
(\d{1,2}:\d\d):(?=\d\d)maybe that’s better?
(:\d{1,2}):the shorter the pattern, the better
-
@Pan-Jan ,
Your regex does not provide all the same groups (and thus features) of the regex developed through this thread, and thus likely misses some of the functionality needed
-
@PeterJones said in Wildcard in replace field:
and thus likely misses some of the functionality needed
show on the example in this thread that it doesn’t work
(\d{1,2}:\d\d):(?=\d\d)
but this one has disadvantages, and he will also mark it here
126:23:45
126:23:450
12:23:45:67it will be correct
(^| )(\d{1,2}:\d\d):(?=\d\d( |$))
-
This post is deleted! -
(^| )(\d{1,2}:\d\d):(?=\d\d([ ,'!\.\?"”\)]|$))