hallo!
now i've a problem with pattern. i've a string like this
Karma:%26lt;/dt%26gt; %26lt;dd%26gt;%26lt;a href=''#'' onclick=''lc.general.showKarma(48737); return false;''%26gt;%26lt;span class=''positiveKarma''%26gt;12
and i want to replace this part of the string with a ''\t'' (a tabulator);
%26lt;/dt%26gt; %26lt;dd%26gt;%26lt;a href=''#'' onclick=''lc.general.showKarma(48737); return false;''%26gt;%26lt;span class=''positiveKarma''%26gt;
so that i've in the end only
Karma: 12
i serched and read in the F1-help of adobe flash, but i do nut understand how i can tell pattern to replace something from the first %26lt;/td%26gt; until the Karma''%26gt;
please, if anybody can explain it to me (uh, in simple words if it is possible) ... taking the hole string is not very helpful, because this will be a part of an while-loop. hm, i want to use in the end a code like this (hm, this is somethink i've tryed and it doesn't work)
var pattern:RegExp = /(from-here-string)-(to-here-string)/;
profil_a[i] = profil_a[i].replace(pattern, ''\t'');
an easy pattern problem, i think - but...See if the following handles all cases:
var pattern:RegExp = /%26lt;\/dt.+%26gt;/;
an easy pattern problem, i think - but...yes, that's what i want, thank you very much!
hm, can you please explain me every step between / and /? hm, i copy %26amp; past it, but i do not understand it, and i've got some other code here where i want to do things like that.
well, i see my dt, i think this is the start ... but why does it stop in front of the number i want?
%26lt;\/dt?matches the?''%26lt;/dt'' near the beginning
.+%26gt;?matches everything else up thru the last ''%26gt;''
If you want to learn about regular expressions you should Google and find a web site that explains how to use them.?That's what I did to answer your post.?That's what I do to answer alot of posts-- you'd be amazed how much you can learn and how many questions can be asnwered by searching with Google.
hm, google is so full of blogs and those things - however, thanks for your little expaination, this helps me a little with my code 8-)
Your response regarding Google indicates you probably need to learn how to use search engines as well.?Google is one of the most useful designer/developer tools available.?It frees you from having to ask others to solve your problems.
No comments:
Post a Comment