Skip to main content
Formatting.
Source Link
trincot
  • 357.1k
  • 38
  • 282
  • 338

exampleExample input abc55def789KK23GOOD9999910ONEM109ORE19k6

abc55def789KK23GOOD9999910ONEM109ORE19k6 

output 789 109Output

789 109 

exampleExample input abcdef

abcdef 

output -1Output

-1 

thisThis is what I need to achieve via the regex code. I

I have gone through innumerousnumerous websites for tutorials but couldn't decipher it as needed.

My idea was to use this regex rx("[0-9][0-9][0-9]""\-""[0-5][0-5]")

rx("[0-9][0-9][0-9]""\\-""[0-5][0-5]") 

butBut then I couldntcouldn't understand the smatchsmatch flag and how to retrieve the results.

example input abc55def789KK23GOOD9999910ONEM109ORE19k6

output 789 109

example input abcdef

output -1

this is what I need to achieve via the regex code. I have gone through innumerous websites for tutorials but couldn't decipher it as needed.

My idea was to use regex rx("[0-9][0-9][0-9]""\-""[0-5][0-5]")

but then I couldnt understand the smatch flag and how to retrieve the results.

Example input

abc55def789KK23GOOD9999910ONEM109ORE19k6 

Output

789 109 

Example input

abcdef 

Output

-1 

This is what I need to achieve via the regex code.

I have gone through numerous websites for tutorials but couldn't decipher it as needed.

My idea was to use this regex

rx("[0-9][0-9][0-9]""\\-""[0-5][0-5]") 

But then I couldn't understand the smatch flag and how to retrieve the results.

Source Link

how would we print out the three digit numbers in a string using regex in c++?

example input abc55def789KK23GOOD9999910ONEM109ORE19k6

output 789 109

example input abcdef

output -1

this is what I need to achieve via the regex code. I have gone through innumerous websites for tutorials but couldn't decipher it as needed.

My idea was to use regex rx("[0-9][0-9][0-9]""\-""[0-5][0-5]")

but then I couldnt understand the smatch flag and how to retrieve the results.