indexOfの head セクションを呼び出していjQueryます。font-weight:boldCSS にプロパティが含まれているかどうかを確認したい。問題は、そのプロパティに 4 つの変更を加えることができるということです。
font-weight:boldfont-weight: boldfont-weight :boldfont-weight : bold
正規表現を使用してこれを一致させるにはどうすればよいですか?
これを試して
\b(?:font-weight\s*:[^;\{\}]*?\bbold)\b
または使用する方が良いでしょう:
\b(?:font-weight[\s*\\]*:[\s*\\]*?\bbold\b)
説明
\b                # Assert position at a word boundary
(?:               # Match the regular expression below
   font-weight       # Match the characters “font-weight” literally
   [\s*\\]           # Match a single character present in the list below
                        # A whitespace character (spaces, tabs, and line breaks)
                        # The character “*”
                        # A \ character
      *                 # Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
   :                 # Match the character “:” literally
   [\s*\\]           # Match a single character present in the list below
                        # A whitespace character (spaces, tabs, and line breaks)
                        # The character “*”
                        # A \ character
      *?                # Between zero and unlimited times, as few times as possible, expanding as needed (lazy)
   \b                # Assert position at a word boundary
   bold              # Match the characters “bold” literally
   \b                # Assert position at a word boundary
)
お役に立てれば。
整数700として設定するfont-weight:bold;ことも、文字列の範囲をかなり一致するように拡張する省略表記を使用して設定することもできます。font
\b(?:font.*?:[^;]*?\b(bold|700))\b
    そのために正規表現を使用することはできません。CSSには次のような文字列が含まれる場合があります
.foo{ content: "font-weight:bold;" }
適切なパーサーが必要です。幸いなことに、ブラウザーには 1 つあり、個々の CSS ルールにアクセスするためのAPIを提供します。
これを試して:
/font-weight\: bold|font-weight\:bold|font-weight \:bold|font-weight \: bold/
    これを試して:
RegularExpressionValidator.ValidationExpression = "font-weight\s?:\s?bold"