Forum > General
Basic Strings, Fresh eyes please.
commodianus:
Works, though I can't help but think I was close to something the other way.
--- Code: ---
ArtName := RightStr(CurArt, Length(CurArt) - Pos('">', CurArt)-1);
ArtName := LeftStr(ArtName, Pos('</a>', ArtName)-1);
--- End code ---
eny:
Try using Andrey V. Sorokin's fantastic regular expression engine.
Impossible to find nowadays. I managed to find a French site where the full FPC compatible code is available: download from here.
For example:
--- Code: ---var reg: TRegExpr;
begin
reg := TRegExpr.Create;
reg.Expression := '<a href="(.*?)">(.*?)</a>';
if reg.Exec(CurArt) then
ArtName := reg.Match[2];
reg.Free;
end;
--- End code ---
marcov:
--- Quote from: eny on April 02, 2010, 11:12:30 pm ---
--- Code: ---
reg.Expression := '<a href="(.*?)">(.*?)</a>';
--- End code ---
--- End quote ---
Sorry, prefer something readable ;-)
eny:
--- Quote from: marcov on April 03, 2010, 01:40:14 pm ---Sorry, prefer something readable
--- End quote ---
Better learn to read then :'(
theo:
marcov is right, RegEx Syntax is a PITA and looks even more odd in a "pascal environment".
Navigation
[0] Message Index
[#] Next page
[*] Previous page