Jemand zu Hause?
2025-12-12T14:43:17 GwenDragonDas Scannen von HTML ist sowas von falsch, da hat die KI falsch gelernt.
QuoteMe:
Extend Perl regex to filter flags symbols and Emojis from HTML source.
Current code is
$string =~ s|([\p{Block=Miscellaneous_Symbols}\p{Emoji_Presentation}\p{Block=Dingbats}])||gs;
KI:
To extend your Perl regex for filtering flags, symbols, and emojis from HTML source, you can adjust it to cover flags and a broader range of emojis. Here’s how you can modify your regex:
$string =~ s|([\p{Block=Miscellaneous_Symbols}|
\p{Emoji_Presentation}|
\p{Block=Dingbats}|
\p{Block=Enclosed_Alphanumerics}|
\p{Block=Geometric_Shapes}|
\p{Block=Transportation_Symbols}|
\p{Block=Supplemental_Symbols_and_Pictographs}|
\p{Block=Flags}])||g;
Explanation of the Code:
1. Block Definitions:
- Miscellaneous_Symbols: Captures various symbols.
- Emoji_Presentation: Matches emojis that are represented in emoji format.
- Dingbats: Includes dingbat symbols.
- Enclosed_Alphanumerics: Covers alphanumeric symbols within a box.
- Geometric_Shapes: Matches geometric symbols, which can also include emoji-like shapes.
- Transportation_Symbols: Includes symbols related to transportation.
- Supplemental_Symbols_and_Pictographs: More emojis and pictorial symbols, including additional icons.
- Flags: Captures flag emojis.
2. Global Modifier g: Ensures all matches in the string will be replaced, not just the first.
Usage:
This improved regex pattern can effectively remove both flags and a broader range of symbols and emojis from your HTML source. Just apply this modified regex in the same way as your original code.
Feel free to adjust or extend the regex further depending on any specific symbols or emoji blocks you may need!
1
2
3
4
5
6
7
8
9
Perl 5.42 X:\TEST>perl -cw a.pl
Can't find Unicode property definition "Block=Transportation_Symbols" in regex; marked by <-- HERE in m/([\p{Block=Miscellaneous_Symbols}|
\p{Emoji_Presentation}|
\p{Block=Dingbats}|
\p{Block=Enclosed_Alphanumerics}|
\p{Block=Geometric_Shapes}|
\p{Block=Transportation_Symbols} <-- HERE |
\p{Block=Supplemental_Symbols_and_Pictographs}|
\p{Block=Flags}])/ at a.pl line 18.
Quotecan effectively remove both flags and a broader range of symbols and emojis from your HTML source.
2025-12-13T16:15:55 rostiWeil Leute das unwissend eingeben in Kommentaren diverser Foren und Blogs.Quotecan effectively remove both flags and a broader range of symbols and emojis from your HTML source.
Wieso weshalb warum? Wie kommt das da rein ins HTML und warum muss das weg? Warum kommt es überhaupt ins HTML?
QuoteWie nutzlos ist da das Lesen der Emojis.
2025-12-13T19:03:32 rostiWeil das alte Inhalte sind, als Barrierearmut gesetzlich noch nicht vorschrieben war.QuoteWie nutzlos ist da das Lesen der Emojis.
Genau. Und warum landen die dann im HTML?
QuoteBei bestehenden Websites nicht machbar.2 Möglichkeiten:
1. Zeichenkodierung ISO 8859-1,da gibt es diese Fratzen nicht,
2. die geposteten Texte vor dem INSERT bereinigen.
QuoteDu meinst per JavaScript alle Text-Nodes im DOM per object.replace(/…/, "") säubern; nicht möglich, muss auch ohne JS laufen.Und wenn HTML-Sourcen zu bereinigen sind, würde ich das auf DOM-Ebene machen.
2025-12-15T12:23:50 rostienctype ist kein Filter und auch kein Garant, dass vom Browser nur Latin1 kommt.Btw. ISO 8859-1
das Problem ist, daß man Emojis auch eingeben kann wenn das HTML-Formular in ISO-8859-1 ausgeliefert wurde.
QuoteJa. Javascript "denkt" zu viel mit.Und wenn JS im Spiel ist, werden dann alle Eingaben auf utf-8 umgeschossen.
QuoteSo wie Tollwut!? ;-)Unicode ist toll.
use strict; use warnings;