Yes, it was what I thought. I will make my own Bead based on that but I think that I could put on the Royale framework. Perhaps a RegularExpression bead or RegExp bead. What do you think?
Yishay Weiss <yishayj...@hotmail.com> escreveu no dia quarta, 6/07/2022 à(s) 12:36: > I had a quick look at Restrict.as and it looks like it’s main use-case is > to remove a class of chars. If you want to force a certain pattern I think > you are better off writing your own (similar) bead which could use > String.match() [1]. You can then read result and replace text input with it. > > [1] String - Adobe ActionScript® 3 (AS3 ) API Reference< > https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/String.html#match() > > > > From: Hugo Ferreira<mailto:hferreira...@gmail.com> > Sent: Wednesday, July 6, 2022 12:01 PM > To: Apache Royale Development<mailto:dev@royale.apache.org> > Subject: Regular expression - need help > > Hi, > > I'm not an expert on regular expressions, however I know that they can > replace a huge amount of complex code. > > I'm using a Restrict bead with this pattern [^0-9] to only allow numbers > and works like a charm for only integers text input. > > However I now need a pattern to only accept numbers BUT also one single dot > (.) after a number and one single optional minus (-) as the first > character. > > I came up with this solution that works in a test tool: /^\-?\d*\.?\d*$/ > Here the test tool: > https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_regexp_not_0-9 > (just replace the pattern). > > I can't use this pattern directly on Restrict bead. > Seems that the Restrict bead is based on the opposite but since I'm not a > regular expression expert, I'm not sure. > > Can anyone please convert my regular expression pattern /^\-?\d*\.?\d*$/ to > be compatible with the Restrict bead ? > > Thank you in advance. > >