Skip to main content

Timeline for answer to extracting original regex pattern from std::regex by Dimitrios Bouzas

Current License: CC BY-SA 3.0

Post Revisions

13 events
when toggle format what by license comment
May 23, 2017 at 10:31 history edited URL Rewriter Bot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Jun 22, 2015 at 23:04 history edited Dimitrios Bouzas CC BY-SA 3.0
added 808 characters in body
Jun 22, 2015 at 23:00 vote accept inetknght
Jun 22, 2015 at 23:00
Jun 22, 2015 at 22:57 comment added Lightness Races in Orbit Fair enough, if it's being called a lot then I wouldn't do that. :) Either way I think you have everything you need here. Yay!
Jun 22, 2015 at 22:57 comment added Praetorian @101010 Of course​​​​​​​​​​​​​​​​, go ahead. @inetknght That's why I said using that solution depends on your use case. If your regex pattern is persistent, and you want to avoid constructing a new one each time, then by all means pass both the regex and the string separately.
Jun 22, 2015 at 22:57 comment added inetknght @Praetorian yes but that would force the runtime to re-parse the regex every time the function is called. I'm trying to go for speed efficiency so passing a unifying structure (such as what 101010 presented) to use it.
Jun 22, 2015 at 22:56 comment added Dimitrios Bouzas @Praetorian Yes your solution seems more elegant. Do I have your permission to add it to my answer?
Jun 22, 2015 at 22:53 comment added Lightness Races in Orbit That's probably what I'd do.
Jun 22, 2015 at 22:53 comment added Praetorian Another option, depending on whether the regex pattern needs to be available elsewhere, would be for validate_content to take an std::string argument containing the pattern, and construct the regex locally.
Jun 22, 2015 at 22:51 history edited Praetorian CC BY-SA 3.0
Improved quote formatting
Jun 22, 2015 at 22:49 comment added Dimitrios Bouzas @LightnessRacesinOrbit I totally agree.
Jun 22, 2015 at 22:47 comment added Lightness Races in Orbit It's one of those things that makes perfect sense and shouldn't be changed, but is just really annoying.
Jun 22, 2015 at 22:45 history answered Dimitrios Bouzas CC BY-SA 3.0