Regex :: Finding Chars In Text With AS3
Dec 17, 2011
I have to validate a textfield in AS3 if there are chars like # $ % @ ~ | {} [] / etc. i.e find unnecessary chars and remove them from the textfield. I use a search AS3 function which works with regular expressions, I would like a regular expression so that a search function searches the characters above and if it finds any of them then returns true.
View 2 Replies
Similar Posts:
Aug 13, 2010
Basically I am using UTF-8 characters codes u0000 to u0008 as part of a socket server.I need a little regex pattern to replace these chars with somthing like a $ symbol to make them really obvious (while tracing output etc..).I believe it should be something like:
Code:
filter:RegExp = new RegExp("[u0000u0001u0002u00..]");
myNewString = myString.replace(filter, "%")
View 6 Replies
May 13, 2011
I'm looking for a regular expression that can remove all the following characters from a string (and Whitespace too): ~ % & ; : " ' , < > ? #
View 3 Replies
Dec 23, 2011
I have the following code (AS3 & CS 5.5):
var regEx:RegExp = new RegExp(/(?:^|s)(#[^s$]+)/g);
var txt:String = "This #asd is a test tweet #hash1 test #hash2 test";
var matches:Object = regEx.exec(txt);
trace(matches);
The trace returns '#asd,#asd'. I really don't understand why it would to this, as in my RegEx testing application 'RegExhibit' it returns '#asd,#hash1,#hash2', which is what I'd expect.
View 1 Replies
Feb 5, 2008
i'm having a bit of an issue with a multilanguage little flash chatprogram. It has a input textfield, the right fontdata and characters are embedded, but slovenian users can't input some chars Although it works when they copy/paste text into the inputfield, then the characters show and all seems well. But actually typing them seems to fail. So i know it's not the infamous wmode bug.
View 2 Replies
Mar 15, 2011
my text was working fine before, but for some reason now it's displaying weird characters. For example the accented vowels in spanish firefox will let me type but google chrome won't. It's like all my keys are mismatched or something.When I try to type Thai, musical notes were showing up in it's place! But it's only for this one swf. I created a brand new swf with an input box and typed thai/spanish and it worked fine, it's only for this already existing file. I have no idea where I can even look to solve such a problem. Is it a publishing setting? Could it be the flash settings in the html?
Where do I look that would effect the keyboards input like this? It worked fine before and I haven't been playing with the text at all. I recently added external interface then commented it out and still doesn't work. The font is _sans which usually displays every language fine.
View 1 Replies
Aug 28, 2005
I want to loop through a text field and find out the _x positions of each char/letter (ignoring the spaces and dashes "-")for exampletesttxt="R o-b o t" I`m trying to get an array with something like pos_array=[12,27,34,40,56]I need to have movie clips align under each char so i need to know where the little fellas are
View 1 Replies
Nov 30, 2009
using a one line TextField with a fixed width that display text from the keyboard. I'd like that when the display text become greater, it aligns itself on the right, and let appear all the new characters, making the left ones disappearing. That is to say, it slides from right to left, letting always the right part of the text visible. I've tried using the "align" property of TextFormat set to "right", but it doesn't work (it just good to align a paragraph), and cut my text.
View 2 Replies
Nov 17, 2009
I am using a regular expression to find links in a generic string and highlight that text(underline, a href, anything).Here's what I have so far:
var linkRegEx:RegExp = new RegExp("(https?://)?(www\.)?([a-zA-Z0-9_%]*)\b\.[a-z]{2,4}(\.[a-z]{2})?((/[a-zA-Z0-9_%]*)+)?(\.[a-z]*)?(:\d{1,5})?","g");
var link:String = 'generic links: www.google.com http://www.yahoo.com stackoverflow.com';
[code]......
View 3 Replies
Aug 31, 2010
In flex, how to remove empty lines in text area?
View 1 Replies
Jan 2, 2010
i have made a dynamic text box which pulls a twitter status using the API. what i want to do is find and replace ': )' (without the space)with a small graphic called 'smile.gif'
View 7 Replies
Mar 7, 2011
I am trying to get a regex match on HTML code that is parsed into a text box in flash. I have successfully loaded the HTML code and then began the regex matching, but am stuck on getting the right regex expression to match. The code that I am using in html page builds a tree view list on the html page, so once it's loaded into the flash text box, i am trying to match the html pages to build a list from. The code below is what I am trying to match. The code I want to match is the first two items in quotes for each entry to build the array list of page names, and their URL. The problem is that the pages won't be named as nice as the example below. Each time it can be a different page name, and page url, so I need to match what is in the first two quotes.[code]
View 2 Replies
Dec 23, 2009
I need to filter log messages based on the log level and a text appearing in the log message. These messages are in the following form: 2/23/2009 17:33:26.379 [INFO] TMSNG.Main Channelset configured with url [http://172.16.34.4:8080/tms-flux/messagebroker/streamingamf] 12/23/2009 17:33:26.380 [DEBUG] org.springextensions.actionscript.core.command.CompositeCommand Executing composite command '[object CompositeCommand]' in sequence
I already have the code below that creates 2 regular expressions (one for the level and one for the text) but I was wondering how I could combine these into one. I tried several combinations, but since my regexp skills are non-existing I couldn't get this to work.
[Code]...
View 1 Replies
Mar 1, 2012
I've been struggling with this problem for a while:I have a string containing HTML and I'm using a regular expression to get the characters between the tags. I'm then attempting to apply a TextFormat to those characters.The problem is that I'm using the TextField's "htmlText" property instead of it's "text" property (because I don't want the HTML tags to be visible). So, the character index that's returned from the regular expression is incorrect, when I apply the TextFormat.Here is some sample code which illustrates the problem:
var txt:String = "<b>Sample</b> string with bold text";
var tf:TextField = new TextField();
addChild(tf);
[code].....
View 2 Replies
Mar 12, 2010
I know that as3 has some powerful new text search capabilities, especially when combined with regex. I don't even know if this is possible, but I would like to somehow, search any block of text, and return all nouns, adjectives and verbs. What would be the best(most efficent) way to do this? Is regex an option? or would I have to load in some sort of open sourced dictionary 9as used in spellcheckers) to compare with or?? After, I've pulled all the nouns, adjectives and verbs, I need to count and prioritize by their frequency.
View 4 Replies
Jul 5, 2010
I'm trying to show < and > in dynamic text fields, pulled in dynamically from an xml file. The text is embedded in a CDATA block and I use < and > to show them. This has worked fine with all previous versions of the Flash player, but Flash 10.1 seems to be trying to read this as html and does not display it.
Flash 10.0 displays this: Press <FN><F2> key sequence to...
Flash 10.1 displays this: Press key sequence to...
Using Flash CS4, publishing as Flash 8, AS2
View 5 Replies
Aug 17, 2009
So, I have a dynamic text box, which, naturally, being dynamic, changes. What I would like to figure out is how to tell when the changing text is larger than the textbox holding it. Of course, just because it is a certain number of characters long doesn't mean it will be larger than the textbox holding it. Twenty of the letter "w" is larger than twenty of the letter "i" So, is there a way to tell if the textbox isn't large enough to hold its text?
View 5 Replies
Mar 13, 2009
I have a movie with two objects; one movieClip with the instance name 'ballInstance' one dynamic text field with the instance name 'textInstance'
The MC is draggable. I'd like my SWF to repeatedly check the MC's x position in relation to the stage's width so that if the ball is on one side of the SWF, the text bos says "left" and if it's on the other side, the text box says "right".
I got the ball to be draggable/releasable. If the ball starts on one side, the text box says left, if it starts on the other side, the text box says right.
BUT for some reason it doesn't update the text when you move the ball. (the MC is a ball.)
How can I tell the SWF to actively re-determine the ball's x-position, and then change the text, if needed?
**full code below, .FLA attached.**
Code: Select allvar stageWidth:Number = Stage.width / 2; /*stageWidth = the width of the stage.*/
var ballX:Number = ballInstance._x; /*ballX = the x position of the ball.*/
/* this will let the user drag around the ball.*/
[Code].....
View 2 Replies
Nov 15, 2011
Im retrieving tweets, so i have dynamic text, but i the tweets occasionally contain hyperlinks. I know you can find the hyperlinks in text. But every technique i have tried has failed, i think its because there searching through an array and then converting that to a string
Well heres my code:
function userTimelineResult(e:TwitterEvent):void
{
for (var i in e.data)
{
[Code].....
View 4 Replies
May 20, 2010
finding a number in a string of text. how can i do this?
example:
var1 = "string of text 35";
trace(magical number finder);
output: 35
View 1 Replies
Aug 23, 2008
I have a dynamic text field in flash that is populated by an input box. The dynamic text field has a maxmium width it can be. So i have it as multiline WITH wodrwap on. My problem is that I have to send this data to server and for the php to be able to text the text and output the text as it is displayed in flash. There seems to be no way of finding the linebreaks and passing them in the string as far as I can see?
View 16 Replies
Aug 7, 2009
I'm having troubles with textfields. I have numerous textfields on the stage but it's happening to all so I'll just describe one.Lets say I have an input textField named that I restrict to allow only numbers 0-9:inputText_txt.restrict="0-9";That all works fine.THE PROBLEM:When I select the field (which initial value is set to "0") and hit delete it clears the field and if I press ENTER it will accept that as a value.I've tried this code to say if it equals " " then to not save the file....
if(inputText_txt.text==" "){
trace("."+inputText+".");
}
[code]........
View 3 Replies
Jun 17, 2010
I'm working on an A.S 2 document that loads chunks of text from an xml file and places them in different dynamic text boxes. The amount of text in each section differs but each one has to appear one after the other regardless of the size.At the minute I'm trying to position the second one beneath the first by making its y value 10 + the height of the first one. however the height that i keep getting is the original one and not the re-sized one.
Africadetails.autoSize = true;
Africaname.autoSize = true;
Africadetails._y = (Africaname._y) + (Africaname._height) + (10);
AfricaURL._y = (Africadetails._y) + (Africadetails._height) + (10);
View 1 Replies
Jun 17, 2010
I'm working on an A.S 2 that loads chunks of text from an xml file and places them in different dynamic text boxes. The amount of text in each section differs but each one has to appear one after the other regardless of the size. At the minute I'm trying to position the second one beneath the first by making its y value 10 + the height of the first one. however the height that i keep getting is the original one and not the re-sized one.
My code is
Africadetails.autoSize = true;
Africaname.autoSize = true;
Africadetails._y = (Africaname._y) + (Africaname._height) + (10);
AfricaURL._y = (Africadetails._y) + (Africadetails._height) + (10);
View 1 Replies
Dec 9, 2009
i have tons of input textfields (over 100) and i want to exclude some chars like '&' from them is there an easy way to set it so that all textfields wont use the chars i want to exclude?or do i accualy have to set them all manualy to not use them?
View 5 Replies
Mar 26, 2011
I'm working on my own buttons. It uses a dynamic TextField, and there's an issue that I can't figure out.
Used font is Lucida Sans Unicode, I exported this to the library, checking "Export for Actionscript..." in dialog window when exporting. Unfortunately, this exported font doesn't display my national chars - I'm from Poland and need letters like "Ĺ‚" or "Ĺ›". They are in this font, but became unavailable after export.
Button photo (prepared "manually" before, looks the same, but text is without "Ĺ‚"):
My code:
protected function prepareShape():void {
isActive = false;
bgMatrix = new Matrix();
[Code].....
View 5 Replies
Oct 10, 2010
I'm running a flash game on asp.net frame. The flash is sending parameters to some asp.net page that save those parameters to a database. My problem is that if the parametrs contain special chars (Russian, Arabic...) then those chars are transform to question marks (?) I've tried to urldecode the parameters but without
The parameters that sent from the Flash are in unicode format and are urlencoded.
The asp.net code is:
string pp4 = "";
if (Request.Form["param4"] != null) { pp4 = Server.UrlDecode(Request.Form["param4"]); }
...
...
[Code]....
View 1 Replies
Aug 1, 2011
I'm using FLASH form embedded into html which use utf8 charset to send variables and image to php script which saves them mysql.
In flash I do use fileupload method,
var loc:*=new flash.net.URLRequest("http://url.com/code.php?s=1&name=" + vardas.text + "&email=" + email.text);
fileHandler.upload(loc);
The problem is that when I open and fill up form in INTERNET EXPLORER, i receive not UTF-8 variables in php, but if I use CHROME or FIREFOX, i get them right.
Is there a difference how IE and other browsers send data? Or do I have to somehow encode variables in action script?
url in IE not supporting chars like ÄŤ while CHROME AND FF DOES?
View 2 Replies
Oct 14, 2011
I have a textfiled (input type) which works with English lang. If I change to different locale in the system tray I am not able to write any text into the textfiled.
How can I enable this capabilty to the TextField or this is connected with locale/Language support in the swf?
View 1 Replies
Oct 31, 2011
I am trying to figure out why some letters (like the norwegian Ă… (Ă…)) are cutted out in the middle of the top "o":
My code is this:
var titleFormat:TextFormat = new TextFormat();
titleFormat.size = textSize;
// this is embedded font, and exported for action script, declared
titleFormat.font = myFontBold.fontName;
titleFormat.bold = true;
[Code] .....
So, I have tried different things like setting height hardcoded and bigger than text, but top us cutted again, I have tried with css but no success. Why the letter is not showed fully and why if I zoom in the swf (2-3 zoom ins) it shows up normal (and what i try to achieve) like this: I think it has to do with the topMargin, but unfortunately I didn't find something like that in as3 documentation.
View 1 Replies