How using Regular Expressions

If you need help on how to use the program
Post Reply
fulvio53s03
Posts: 776
Joined: 2007-04-28 05:46:43
Location: Italy

How using Regular Expressions

Post by fulvio53s03 »

Dear Friends,
I need a way to change uppercase letters to lowcase letters when following HTML beginning tags
(i mean:
<Table to <table or
</Div to </div ecc.).
Do you think it could be possible?
Would you give me a statement example to insert in a script?
thanks in advance.

:)
antp
Site Admin
Posts: 9712
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

I doubt you can achieve that with regular expressions, but there is the LowerCase function that does that (it takes a string as input parameter and returns the lowercase function of it).
fulvio53s03
Posts: 776
Joined: 2007-04-28 05:46:43
Location: Italy

Post by fulvio53s03 »

antp wrote:I doubt you can achieve that with regular expressions, but there is the LowerCase function that does that (it takes a string as input parameter and returns the lowercase function of it).
Thanks.
I know function Lowercase, but I need to change only words between
< and >
or
< and >
.... see this:

Code: Select all

Procedure Normalizza_page(Pagina: string);    // elimina i crlf, trasforma delimiters maiuscoli in minuscoli
begin
  CharAbNormal := crlf;
  CharNormal := ' ';
  pagina := StringReplace(pagina, CharAbNormal, CharNormal);
  CharAbNormal := '<B';
  CharNormal := '<b';
  pagina := StringReplace(pagina, CharAbNormal, CharNormal);
  CharAbNormal := '</B';
  CharNormal := '</b';
  pagina := StringReplace(Value, CharAbNormal, CharNormal);
  CharAbNormal := '<FONT';
  CharNormal := '<font';
  pagina := StringReplace(pagina, CharAbNormal, CharNormal);
  CharAbNormal := '</FONT';
  CharNormal := '</font';
  pagina := StringReplace(pagina, CharAbNormal, CharNormal);
  CharAbNormal := '<TR';
  CharNormal := '<tr';
  pagina := StringReplace(pagina, CharAbNormal, CharNormal);
  CharAbNormal := '</TR';
  CharNormal := '</tr';
  pagina := StringReplace(pagina, CharAbNormal, CharNormal);
  CharAbNormal := '<TD';
  CharNormal := '<td';
  pagina := StringReplace(pagina, CharAbNormal, CharNormal);
  CharAbNormal := '</TD';
  CharNormal := '</td';
  pagina := StringReplace(pagina, CharAbNormal, CharNormal);
  CharAbNormal := '<DIV';
  CharNormal := '<div';
  pagina := StringReplace(pagina, CharAbNormal, CharNormal);
  CharAbNormal := '</DIV';
  CharNormal := '</div';
  pagina := StringReplace(pagina, CharAbNormal, CharNormal);
end;
antp
Site Admin
Posts: 9712
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

But what's the point of that, actually?
Isn't the case of the tags always the same between different movies, for a given site?
fulvio53s03
Posts: 776
Joined: 2007-04-28 05:46:43
Location: Italy

Post by fulvio53s03 »

antp wrote:Isn't the case of the tags always the same between different movies, for a given site?
No, unfortunately sometime it happens, when changing pages lay-out of sites, that old pages have html tags with uppercase, new pages with lowercase (or vice-versa)....
It's not a great problem (if I see the changes or someone tells me about them), but, anyway, I was looking for a faster and more efficient way to solve problem, instead of running-after-it :hihi:

uhm... maybe I could create a .pas file with my stringreplace statements.... what do you think? :ha:
bye
Post Reply