Before special character select the text in javascript by regular expression
hi,
can u write regular expression so can select text before special charachter (exp : ";").
examplese
text : absolute; or -9px; or 100% 100%;
output : absolute or -9px or 100% 100%
i write
var reg = /^((?:'(?:\\'|.)*?'|(?:\\|.)*?|\([^\)]*?\)|[^};])+)\s*/;
var m = reg.exec ("absolute;");
but not giving me correct output.
regards
ashish yadav.
we need more facts to give you the right answer.
if want to replace the semicolons in text frame:
var adoc = app.activedocument; var atframe = adoc.textframes; contentstring = atframe[0].contents; contentstring = contentstring.replace (/;/g, ''); atframe[0].contents = contentstring;
this gives the right output for your sample text.
otherwise give better example please.
More discussions in Illustrator Scripting
adobe
Comments
Post a Comment