以下の出力は、XMLスキーマに対してXMLファイルを検証する第三者ツールによって生成されます。検証エラーを出力します。これはちょっとした文脈でした。Perlを使用してHTMLファイルを編集する
上記のエラーがHTMLで表示されているので、perlを使用して「構文強調表示」を実行できるようにしたいと考えています。例えば、私は上記のテキストの特定の部分をハイライトすることができるようにしたい。
具体的には、「Line [0-9] *」に準拠するテキストを太字と赤で色分けしたいと思います。私は正規表現の検索と置換を試してみましたが、成功していません。
任意のポインタ/ヒントは素晴らしいでしょう。
ありがとうございました!
Line 8: Element 'alphabet', attribute 'letters': The value 'XYZ' does not match the fixed value constraint 'ABC'.
Line 185: Element 'drink': The attribute 'coffee' is required but missing.
Line 254: Element 'timeout': This element is not expected.
Line 269: Element 'commands': This element is not expected. Expected is one of (eat, drink, sleep).
Line 812: Element 'software': The attribute 'version' is required but missing.
Line 876: Element 'windows-software': The attribute 'version' is required but missing.
Line 890: Element 'contact': The attribute 'telephone' is required but missing.
Line 890: Element 'operating': The attribute 'mode' is required but missing.
ハイライトしたいHTMLコードの一部と正規表現を表示する必要があります。 –
上記のテキストは、HTMLファイルに表示されるものです。それは私が – sandster
で強調表示を実行したいと思っているものですあなたはそこにはHTMLがないことを認識していますよね?テキストは 'pre'ブロックにありますか? –