Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9164549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:42:38+00:00 2026-06-17T14:42:38+00:00

how I can join these two patterns to fit on a single preg_match_all: I

  • 0

how I can join these two patterns to fit on a single preg_match_all:
I have this:

preg_match_all("/(<span[^>]*annot[^>]*value=.?(\w*).?[^>]*>)(.*?)<\/span>/", $text, $matches, PREG_OFFSET_CAPTURE);

and this:

preg_match_all("/(<span[^>]*value=.?(\w*).?[^>]*annot[^>]*>)(.*?)<\/span>/", $text, $matches, PREG_OFFSET_CAPTURE);

I need the pattern to look for two things at once

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:42:39+00:00Added an answer on June 17, 2026 at 2:42 pm

    Despite the HTML matching thing, try this:

    preg_match_all("/((<span[^>]*annot[^>]*value=.?(\w*).?[^>]*>)(.*?)<\/span>|(<span[^>]*value=.?(\w*).?[^>]*annot[^>]*>)(.*?)<\/span>)/", $text, $matches, PREG_OFFSET_CAPTURE);
    

    They are just combined via an or operator like this:

    (exp1|exp2)
    

    Edit: If I understood what you are trying to do, matching “annot= value=” and “value= annot=”, you can use this regexp instead (Hope I didn’t mess anything, but you should get the idea):

    (<span[^>]*(value=.?(\w*).?[^>]*|annot[^>]*)>)(.*?)<\/span>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two obects, A & B for this discussion. I can join these
How I can join this queries to single select (without temp table)? SELECT t2.value,
In Vim, one can join two lines by typing capital J. However, these are
How can I join 2 Point3f arrays together? I have tried this but it
How can i join these two queries SELECT GLMA_COMP_CODE COMP, GLMA_ACCT_CODE ACCOUNT_NO, GLMA_DEPT_NO DEPT,
How can i join these two queries (Query1-Query2) Query1: declare @date1 datetime,@date2 datetime ,
in F#, array.append can join two arrays; is there a way to append 2
Can i join two tables using LINQ for NHibernate like I can do in
I've to query from two tables and want one result.. how can i join
I have these two tables Orders and Employees Orders Table OrderID EmployeeID 1 1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.