2 Replies Latest reply on May 2, 2013 3:07 PM by [Jongware]

    Before special character select the text in javascript by regular expression

    2007ay Level 1



      can u help to write some regular expression so  I can select the text before some special charachter (exp : ";").



        my text is : absolute;   or  -9px; or  100% 100%;

      output : absolute or -9px or 100% 100%


      i already write


      var reg = /^((?:'(?:\\'|.)*?'|(?:\\|.)*?|\([^\)]*?\)|[^};])+)\s*/;

      var m = reg.exec ("absolute;");


      but its not giving me correct output.



      Ashish Yadav.