236
MasterMaster
236

    Oct 01, 2009#16

    I think you want

    Code: Select all

    /(?<==)\w+(?=;|,)/ 
    as your JavaScript regex object, so the line should be

    Code: Select all

    var findResult = selectedText.match(/(?<==)\w+(?=;|,)/);

    3
    NewbieNewbie
    3

      Oct 01, 2009#17

      I have replaced with the following statement however it does not seems to work.

      Code: Select all

      var findResult = selectedText.match(/(?<==)\w+(?=;|,)/);
      I apologies for not providing the text which I am working on earlier. I am trying to use the regex to extract those strings between the start marker of "=" and end marker of either "," or ";".

      Code: Select all

      C133   C                   1=UNNAMED_1_CON18_I1_A,
                                    2=EARTH;
      C133   C                   1=EARTH,
                                    2=UNNAMED_1_CER_I28_A;
      C177   C                   1=UNNAMED_2_CON18_I6_A,
                                    2=EARTH;
      U13   ACT138            1=UNNAMED_2_87C54C_I42,
                                    2=UNNAMED_2_87C54C_I43,
                                    3=UNNAMED_2_87C54C_I44,
                                    4=_GND,
                                    5=_GND,
                                    6=UNNAMED_2_ACT138_I84,
                                    8=_GND,
                                    9=UNNAMED_1_DIGBLK_I47,
                                    12=UNNAMED_1_DIGBLK_I46,
                                    16=5V_VCC;

      236
      MasterMaster
      236

        Oct 02, 2009#18

        Oops. Big mistake on my part.

        JavaScript does not support lookbehind; I forgot about that entirely.

        So your alternative is to use

        var findResult = selectedText.match(/=(\w+)(?=;|,)/);

        and use findResult[1] as your match. I don't know JavaScript, you'd probably have to feed the selection to it line by line, or you will only get the first match.

        3
        NewbieNewbie
        3

          Oct 02, 2009#19

          I understand that Javascript does not support lookbehind however the Perl Regex Engine within allows entry of Perl Expression that do lookbehind.

          6,686585
          Grand MasterGrand Master
          6,686585

            Oct 02, 2009#20

            The JavaScript core contains a regular expression object using the same syntax as the Perl regular expression engine. But the JavaScript core does not contain the entire, full featured Perl regular expression engine. Don't mix that. The JavaScript regular expression object using Perl syntax is not the Perl regular expression engine.
            Best regards from an UC/UE/UES for Windows user from Austria

            Read more posts (-10 remaining)