Regex in Flex 3: How to Wrap Quotations Around a Dynamic String?
Posted
by Laxmidi
on Stack Overflow
See other posts from Stack Overflow
or by Laxmidi
Published on 2010-06-05T21:45:49Z
Indexed on
2010/06/05
21:52 UTC
Read the original article
Hit count: 286
Hi,
I need some Regex help.
I need to find beacon_ followed by an alphanumeric code and then wrap it in quotation marks. For something static, like the example, below it's straight forward.
myReturn = myReturn.replace( 'id=beacon_80291ee9b3', 'id="beacon_80291ee9b3"');
But, my problem is that the part after beacon is a random alphanumeric code. (However, it is always the same length). For example, the beacon part could be:
beacon_c8ac873136
beacon_dc83b5953e
beacon_7a910d03d8
etc.
The haystack that I'll search will look like:
myReturn = "blah blah id=beacon_80291ee9b3 blah blah";
Thanks.
-Laxmidi
© Stack Overflow or respective owner