Reputation: 103
Could someone please help me with this scenario,
[Some text]
[Some text] Device ID: XYZ123 [Some text]
[Some tex]
I want to extract XYZ123
from the above sample. Appreciate your help.
Upvotes: 0
Views: 107
Reputation: 29552
You can use:
(?<=Device ID: )\b[a-Z0-9]+\b
(get ID via catch group #0)
Assuming your regex engine supports lookbehinds, otherwise use:
Device ID: (\b[a-Z0-9]+\b)
(get ID via catch group #1)
Note: I herein assume that the [
and ]
are not actually found in your source text, are they?
Upvotes: 1