Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Find those html tags that contain only 3 words (with regex)

    Help wanted · · · – – – · · ·
    2
    4
    70
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Neculai I. Fantanaru
      Neculai I. Fantanaru last edited by

      Hello. For example.

      <p class="pintem">Since you loose</p>

      <p class="pintem">Truly creative works remain exclusively in the care of the creative man</p>

      Is it possible to find only those html tags that contain only 3 words (with regex). In my case, only the first line?

      I made a regex, but doesn’t work

      FIND: (<p class="pintem">)\w{1,3}(</p>)

      Alan Kilborn 1 Reply Last reply Reply Quote 0
      • Alan Kilborn
        Alan Kilborn @Neculai I. Fantanaru last edited by

        @neculai-i-fantanaru said in Find those html tags that contain only 3 words (with regex):

        Is it possible to find only those html tags that contain only 3 words (with regex). In my case, only the first line?

        Yes.

        Find: (?-is)<p class="pintem">\w+?\h\w+?\h\w+?</p>

        Neculai I. Fantanaru 1 Reply Last reply Reply Quote 4
        • Neculai I. Fantanaru
          Neculai I. Fantanaru @Alan Kilborn last edited by

          @alan-kilborn said in Find those html tags that contain only 3 words (with regex):

          (?-is)<p class=“pintem”>\w+?\h\w+?\h\w+?</p>

          thank you

          Neculai I. Fantanaru 1 Reply Last reply Reply Quote 1
          • Neculai I. Fantanaru
            Neculai I. Fantanaru @Neculai I. Fantanaru last edited by

            @neculai-i-fantanaru

            Try this:

            <p class="pintem">(?:\W*\w+){3}\W*</p>

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright © 2014 NodeBB Forums | Contributors