297 questions
3 votes
2 answers
92 views
Regex to detect negative numbers but not hyphenated numbers
I want to detect positive and negative integers but not hyphenated numbers. For example: From 2020-2022, the frequency of COVID-19 increased when the temperature fell between 10 and -10 degrees. (2) ...
0 votes
1 answer
123 views
replacing content of capture groups in a c++ regex
I'm using C++20 (Visual Studio 2022) with std::regex (although I recently had to switch to boost::regex to get a non-recursive implementation due to issues like this). I have a long regex with a few ...
1 vote
3 answers
157 views
Why does this regex match a string that is greater than 10 of the desired characters?
I have the following regular expression and I am using https://www.regextester.com/ to test it. ^(?=^.{10})[a-zA-Z]+:[0-9]+\s* The requirement is that the input could be alpha characters and numbers ...
0 votes
1 answer
97 views
Notepad++ regex for text surrounded by double newline
I am trying to find all text blocks in a file, that contain a string, matching the following regex: D[:\/\\]+Apps[\/\\]+ and are surrounded by double newlines. For example in this text: 00,36,00,31,00,...
1 vote
1 answer
209 views
Thread safety of boost::regex_match
ThreadSanitizer gives me an alleged race condition in boost::regex_match. Is this a false positive? I cannot find synchronization primitives that depend on BOOST_HAS_THREADS in the callstacks. All ...
0 votes
1 answer
237 views
Exception when escaping "\" in Boost Regex
I'm always getting an exception when trying to escape a backslash like this: boost::regex shaderRegex{ "test\\" }; Am I doing something wrong? Unhandled exception at ...
0 votes
1 answer
55 views
Does split_regex support group?
Can I setting split_regex working based on groups instead of using lookbehind? The code I'm using is as follows: string data = "xyz: 111.222: k.44.4: 12345"; vector<string> data_vec; ...
0 votes
1 answer
38 views
Difficulty using boost::regex_match to get separate matches for "NASIONAL" and "12" from string "NASIONAL12"
This works fine in all online regex testers but fails to produce any matches in boost::regex_match, which I unfortunately must use as is because it is being used in a system that expects this format ...