ActionScript 3 String Match() help

Hello

I have a several of the hyperlinks on a Web page and I only need to store a few who have a certain rhythm in a variable/table.

I discovered that you can do this with the match() function. I loaded the container on the Web page in a chain, so I'm just using the MATCH function to try to find the model. The problem is, I'm not bad with reg expressions.

The hyperlinks I want to catch are written as follows: < a href = "/somename/sameForAllFilesfile.sz" > link < /a > Some

I only need to store the content between the href =' and ' >.» The file 'sameForAllFiles' is what is common for all files and what I'm trying to use the EQUIV, but I can't get the right expression. Can someone write a basic example of code that I could use?

Thank you!

If you use the 'match' method, so that:

var string: String = "blablabla\

Some link blablabla\

Some Link2.

Some Link3';

//

var directoryTemplate:String = ' / sameForAllFiles / ';

//

[var regSource:String = '<><>] + href = "[^" "] +" + directoryTemplate + "[^" "] +" [^<>] * > ';

var reg: RegExp = new RegExp (regSource, 'g');

//

trace (String.match (REG));

Result:

,,

Tags: Adobe AIR

Similar Questions

  • Another question about regular expressions with String.matches

    don't match String.matches () method expressions when a substring of the string matches, or must match the whole string? So if I have the string '123ABC', and I ask match "1 or more letters" will be it fail because there are other that the letters in the string, but then spend if I add "1 or more letters AND numbers 1 or more? Thus, in the second case each character in the string is recorded in the research, as opposed to the first. Is that correct, or are there ways to JUST matching a substring in the string instead of all this? I'll do some examples too... but that makes sense?

    It must match the entire string. Use Matcher.find () to match on just a sub-string)

  • Hexadecimal string parsing help

    Hi I have a problem with this problem. I use XBEE in API mode and features how it works it sends a string of package API containing the address, length, and data. I have no problem separating those is just when the data comes. If devices expires or is interrupted by another node, it sends the packet but it cannot send a complete data package. For example, it is just part of the data that it sends:

    02CB 33FA FFD4 331D 00AF 3304 00CA 33FB FFD3 331D 00AF 3303

    At the beginning of each data byte is 0 x 33 or 0 x 34, followed by more than 3 bytes. As you can see he has not finished the last byte of data (3303) the rest of the data is contained in the beginning of the next package that would be:

    02CB 33FA FFD4 331D 00AF 3304 00CA 34FB FFD3 00AF 3305 331D

    Thus, the finished data would be 3303 02CB. I'm having a lot of trouble with between them each data packet and adding on a string of incomplete data.

    It's an interesting way to use the input of the splitter in the chain of worksheet to the array function.

    The images below show a simple approach, I think that's what you want.  The part of the code not shown is a shift register.  The string from the left is connected to the shift register terminal to the left.  The first string to right connects to terminal of shift register to the right. The shift register is initialized with an empty string.  The lowest string on the right connects to a terminal autoindexing and creates the table shown in the results.  The constant related to the terminal Regular Expression is defined in "Hex" mode  Read the help for the match pattern for more information on how it works.  Rather than the table would connect you your function to queue for the indicator of substring matching.

    This code replaces all in the structure of your business.

    Lynn

  • Specific string matching (Hex 2E2E)

    I have a file that I have to deal with, a beautiful simple function to create.

    Read file, find the part of the file with the string of some data in it, create the output of data in expanded format table and save the spreadsheet file (for example csv will do)

    This is the problem, the data is in the format:

    PS1 #PS0 #, #PS3 #c3... 31, c34 #... 126

    (I can remove the # and no probs.) The bit that kills me, is that I need to extend the range of c3 to c31. We'll never find a match pattern '.. 'because'. ' is a special character in match pattern and matching of regular expressions - thank you NOR.)

    I can kind to locate using the string split function, but it does not I want very efficient, if someone at - there ideas for a better way around this problem?

    See you soon

    James

    Hi James,

    Try this:

  • Darken a specific string Match (LogFilter)

    I have a string of specific match I need black out for a time determined on a daily basis. We currently have one LogFilter officer set up for that particular log with a match string list that we monitor. There is a single string that I need blackened every morning between 04:00 and 07:45. The only way I think I can do it is if I have LogFilter a second officer and apply only the one corresponding to the string, then I can this particular agent of LogFilter black. Can anyone confirm if it would work? Would I meet problems because we follow the same newspaper on two different officers of LogFilter?

    You can control the same log file with several agents. Each agent will retain its own pointer to the log file of the previous analysis of the new entries in the log file.

  • RegExp string transform help

    Hello

    My version of Oracle: 11G

    Here is a string I get in a flat file:

    2009-01 - 01 T 14: 02:02.789

    My requirement is to transform in 2009-01-01 14:02:02

    (1) T must be replaced by a space

    point 2) and the characters that follow must be replaced by null

    PS: I realized using multiple functions, but you are looking to do this using a function only, I guess regexp_replace might help me thereby or is it does nothing else.

    Concerning

    Rahul

    One more way!

    regexp_replace ('2009 - 01-01 T 14: 02:02.789 ',' t |) () \. [[ : digit :]] * $) «, » ')

  • String conversion help please

    Hi all

    I'm trying to convert the following text:

    ROOM_NUMBER

    MMA-A13_03
    MMA-B13_04
    BOWL - 23 C
    BOWL - 16 C
    CUP-06F

    Select distinct replace (replace (substr (ROOM_NUMBER, instr (ROOM_NUMBER, '-'), 10), '-'), '_', '-') table Short_Room;

    A13-03
    B13-04
    23 C
    16 C
    06TH

    If the first character is a letter that replace it with anything?

    i.e.

    A13 - 03 will become 13-03

    Hmm... You can play a little yourself with REGEXP with the help of Solomon.
    Replace (REGEXP_REPLACE (regexp_replace(room_number,'^[^-]+-\a{0,1}'), '[A - Z].'), '_','-')

  • String replaceAll() help

        //kill characters method used to remove unwanted characters
        //from strings, takes in unedited string, returns formatted string
        private String killChars(String fixThis )
        {
            return fixThis.replaceAll("\\W", "");
        }//end
    Hey guys and girls.

    I have this method in one of my applications and I do not exactly get the results I want. Is there a way to manipulate the replaceAll function arguments so that it will replace all non alphanumeric except for spaces? In fact, I want to keep white space.

    Thank you

    Kyle

    I think you can use "[^ \\s\\w]", which is anything other than whitespace or Word because. try it, see if it does what it takes.

  • ActionScript 3 (if, else help)

    OK it's perhaps hard to explain but I'll try my best I'm going.

    I am creating a Flash CS5 game including through the use of actionscript. This game is very basic and all it consists of is a creature moving (by entries of users with the arrow keys) around the scene. The screen and the creature simulate a movement by making animations in their own separate movie clip frames that simulate the movement.

    The future goal of the game is to dodge the objects animation of the top of the screen vertically downwards.

    I created all the animations how to move the "creature" and created a frame event enter to animate the object to be dodged vertically.

    Now, here's the dillema that I want the object supposed to be dodged to reappear at the top of the screen, after its passage at the bottom. I tried an if else statement, but it doesn't seem to work someone can tell me what to do, what I have wrong or provide a code for me.

    if(dodgeobject_mc.y<400) {}

    dodgeobect.y-= 400

    }

    I hope you can understand this.

    Try:

    {if(dodgeobject_mc.y>400)}

    dodgeobect.y-= 400

    }

  • Adding string Please HELP!

    Hello

    I need to know that action script uses to add channels to the formatting variables.

    For example, I have this code

    public void addString(str1:String):void

    {

    For (i: int = 0; i < data.length; i ++)

    {

    trace (data [i] .str1)

    }

    }

    of course, this does not work but what is the format for the string to properly attached at the end of the data [i]. ??

    trace (data [i]. {} str1});<---something like="" this?----="">

    To get a property defined by a writing value string variable:

    data [i] [str1]

    data [i] are an object of your collection and data [i] [str1] are the property of "str1" of this object.

  • Scan chain corresponds to all adjacent spaces when a sequence of scanning to match an exact string ends in a space

    Recently, I wrote code to parse a string using the string function analysis.  The string contains a descriptive text as well as some of the settings I want to recover the chain.  My approach has been using a format string that match an exact string (descriptive text), that deletes or ignores the exact string and then corresponds to a parameter in the input string.  The remaining string contains more data which are analysed later.

    The problem I encountered is that corresponding to an exact string doesn't seem to work as I expect if the exact string ends with a space.  In this case, the exact string is offset, and other white space characters that immediately follow the exact string.  Let me illustrate by examples (------codes are displayed).

    Case 1: input string = "Line\s1\s\s\nLine\s2".

    string format = "Line\s%d".

    remaining string = "\s\s\nLine\s2".

    Note that spaces and the supply line after that '1' are moved to the remaining string in this case.

    Case 2: input string = "Line\s1\s\s\nLine\s2".

    string format = "Line\s%d\s".

    remaining string = "Line\s2".

    Note that all the spaces and line power immediately after that '1' are deleted and are NOT passed to the remaining string in this case.

    Behavior in case 2, it's not what I was expecting.  Can someone comment on that?  I can probably work around this problem, but would like to understand how the channel Scan function is supposed to work.  Is this a bug?

    Citing the detailed help:

    A space in the format string matches any amount of white space, such as spaces, tabs, line breaks and forms RSS.

  • Determine if a string contains an expression of certain

    Hi all

    I feel that there should be a simple way to do this, but I was not able to understand after browsing these forums, the help of LV and Google.

    I just want to get in a string and returns true if it is false if is not to determine if it contains a certain expression. I understand there are regular expression screw, as model of matching and Match Regex, but those who return substrings; I want just a Boolean value returned. I could use the VI regular expression corresponds to analyze output strings to determine if it finds a match and returns a Boolean value from there, but I feel like there is a way better and simpler I forget.

    In the subpalette of 'additional string functions' I see there first Match string and string of true/false game, but using the first Match string seems like it would complicate what I try to do, and I don't yet know what game true/false String; detailed help is always confusing.

    Thanks for any help!

    There are simple ways. Read the help associated with search string functions! Each of them returns the offset of the found string. It is - 1 if it is not found. A simple function to Less Than Zero can be connected to this to return a Boolean value. Another way is to compare the substring returned by the function of empty string.

  • Match Pattren problem

    Hello

    I use the match function String pattern in Labview to search for the string. I'm getting it's say I strings in order

    ABC

    Test1

    Test

    If I give Test has a regular Expression for the game, I get output matched for Test1, I mean before the substring is ABC, substring matching is trial and after substring is 1 Test.  I'm lookinh for the 3rd line. I have no commas or points at the end of the string. Help, please

    Well, you might have the look of search for "Test\n" or 'Test\r\n' according to your format.  You will then match on a string that has a line that ends with 'Test '.  Of course, this works only if the Test is not the last line in the file.

    Yes, the regular expression would probably be easier.

  • Read from String

    Hi all

    The question I have is probably very trivial, but I apparently I'm stuck with it. The task that I am doing is to transfer a 'string data' that I get from reading via RS232 port of a controller of movement (relative coordinates of the position of the engine), in a table, so I can use it following the curve of the path. The chain is as follows:

    TPM: * TPM + 1274.36, + 0, + 0, + 56.149

    and I want two of these four numbers in the data file, something like this + 1274.36, + 56.149, by rank

    When I put 'write LVM' express VI and wired it "read rs232" to "signal in VI" me gives error that the data do not match. I therefore feel that the string must be changed somehow before it can be written in the data file.

    Can someone help me with this problem please?

    Thanks in advance

    It's my VI:

    You will need to use a function such as match on the palette of the string pattern.  Would be the model to look for the TPM secure: * party TPM assuming that is common on all lines of incoming data.  Then write the part after string matching in a text file.

    Since you just want to write the data to a text file, do not use the file function measure Express.  That really does work well if you already have a data type of 'Signal' as those coming from other Express VI.  Just use functions open close text, write files, in the range of file IO instead.  Search for Finder example for some examples.

  • Need help with filterFunction with special character function

    Hello

    I am a simple/search filter process to a collection of dataGrid on the text with the filterFunction function entries. Is what I am facing problem in one of my column field (on which I'm filtering) point '. ' as a suffix and it is not included in the research process.

    I have a few values as - i_24., i_245., i_256.

    Now with the function current filterfunction when a user entered i_24. It shows another recording as well - i_245, where the expected input should be i_24. (since i_245 is not i_24.5)

    But it seems that the search function does not take point '. ' as a character in the research process, or at least when it is left as a suffix.

    I toilet maybe some RegExp could solve the problem, but I'm not good and more.

    Help, please.

    Thank you.

    Kind regards

    Shad

    aSuitableBoy,

    Use the 'indexOf' of the string method.  (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/String.html#indexOf ()).
    The syntax is the following: "String (.)." indexOf ()

    Here's a little snippet of code that I have written, that works:

    http://www.Adobe.com/2006/mxml"layout ="absolute"creationComplete ="cc (); » >

    Import mx.controls.Alert;

    Import mx.collections.ArrayCollection;

    [Bindable] private var ac:ArrayCollection = new ArrayCollection();

    private void cc (): void

    {

    var o: Object = new Object();

    o.Field1 = "value 1: ';

    o.Field2 = 'i_24.';

    o.field3 = 'another value '. » ;

    ac.addItem (o);

    o = new Object();

    o.Field1 = ' value 2 ';

    o.Field2 = 'i_245.';

    o.field3 = 'another value '. » ;

    ac.addItem (o);

    o = new Object();

    o.Field1 = "value 3:";

    o.Field2 = 'i_256.';

    o.field3 = 'another value '. » ;

    ac.addItem (o);

    }

    private void filterFunc(o:Object):Boolean

    {

    return String (o.field2) .indexOf ("i_24."). = -1 ;

    }

    ]]>

Maybe you are looking for