Good catch. I was misled by the docs [1]. [1] http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/String.html#match()
From: Harbs<mailto:harbs.li...@gmail.com> Sent: Thursday, July 20, 2017 9:40 AM To: dev@flex.apache.org<mailto:dev@flex.apache.org> Subject: Re: [FlexJS] String.match() Both Flash and JS engines automatically convert to RegExp. I had not realized that at first. It seems that the only difference between the Flash engine and JS engines is what happens when constructing a RegExp object from invalid input. Flash matches nothing, while JS throws an error. By just wrapping the call in a try/catch, that seems to resolve the issue. I added the trace because I think it’s bad practice to use strings instead of RegExp because it can lead to unexpected results and a new RegExp instance needs to be constructed every time. > On Jul 20, 2017, at 3:32 AM, Alex Harui <aha...@adobe.com.INVALID> wrote: > > It looks like they just trace a warning instead of trying to convert to a > RegExp. Is that what we want to do? Or should we add code that converts > a string to regex? > > Thoughts? > -Alex > > On 7/19/17, 4:32 AM, "Harbs" <harbs.li...@gmail.com> wrote: > >> I added the utility functions. I think they can be very simple. >> >>> On Jul 19, 2017, at 9:30 AM, Alex Harui <aha...@adobe.com.INVALID> >>> wrote: >>> >>> Unless we are absolutely sure that everybody will need the code >>> generated >>> by the compiler, having the compiler call a framework function makes it >>> easier for an app developer to make any adjustments to that code. It is >>> easier to monkey-patch a utility function than find-and-replace some >>> sequence of code the compiler has sprinkled throughout the output. >>> >>> My 2 cents, >>> -Alex >>> >>> On 7/18/17, 11:36 AM, "yishayw" <yishayj...@hotmail.com> wrote: >>> >>>> Alex Harui-2 wrote >>>>> By >>>>> calling new utility functions, the developer has control over the >>>>> conversion. >>>> >>>> I don't understand that point. Do you mean an app developer? >>>> >>>> >>>> >>>> >>>> -- >>>> View this message in context: >>>> >>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-f >>>> le >>>> >>>> x-development.2333347.n4.nabble.com%2FFlexJS-String-match-tp63392p63405. >>>> ht >>>> >>>> ml&data=02%7C01%7C%7C9ff1088402ef439ca27908d4ce0e97eb%7Cfa7b1b5a7b344387 >>>> 94 >>>> >>>> aed2c178decee1%7C0%7C0%7C636360009448210304&sdata=nprl9yHUtlsTHbIZxeFq2h >>>> %2 >>>> FQNWmtimM%2BxAt0kJA8EcA%3D&reserved=0 >>>> Sent from the Apache Flex Development mailing list archive at >>>> Nabble.com. >>> >> >