Capture Characters after special Char with Regex

1593 views regex

I have strings that are built like this

"Colour: Black
Size: L"

"Colour: Black
Size: XS"

All i want to capture are the characters after Size: but with no whitespace, I have come up with the following


answered question

So what's your question? Is it not working the way you expect? What results are you getting?

Im getting space after Size: so im looking to get rid of the white space also.

2 Answers


You can use this regex and capture group 1's content,



  • ^ --> start of string
  • Size:\s+ --> This matches Size: literally followed by one or more whitespace characters
  • (.*?) --> Captures the string you are interested in
  • $ Matches end of string


posted this

Try Regex: (?<=Size: ).*?(?=")


posted this

Have an answer?


Please login first before posting an answer.