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

  • Home
  • SEARCH
  • 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 255841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:57:51+00:00 2026-05-11T21:57:51+00:00

Is there a utility that will convert POSIX to PCRE for PHP? I’m somewhat

  • 0

Is there a utility that will convert POSIX to PCRE for PHP? I’m somewhat confused by the PHP manual on PCRE, and while I’ll try to find more info on PCRE, I was wondering if anyone had designed such a utility.

Or, if anyone would explain how to convert the following, that would also be fine:

ereg("^#[01-9A-F]{6}$", $sColor)

But please explain how it’s done, not just tell me the conversion.

  • 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-05-11T21:57:52+00:00Added an answer on May 11, 2026 at 9:57 pm

    preg_match("/^#[01-9A-F]{6}$/", $sColor)

    In this case you only need to add the two delimiters.

    In perl you can write something like

    if ( s =~ /x.+y/ )
    { print "match"; }

    As you can see the actual regular expression is encapsulated in //. If you want to set an option on the regular expression you put it after the second /, e.g. switching the expression to ungreedy by default /x.+y/U
    pcre now emulates this behaviour. Though you have to call a function you also have to provide the delimiters and set the options after the second delimiter. In perl the delimiter has to be /, with pcre you can chose more freely

    preg_match("/^#[01-9A-F]{6}$/", $sColor)
    preg_match("!^#[01-9A-F]{6}$!", $sColor)
    preg_match("#^\#[01-9A-F]{6}$#", $sColor) // need to escape the # within the expression here
    preg_match("^#[01-9A-F]{6}$", $sColor)

    all the same to pcre, best to chose a character that doesn't appear within the expression.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a gettext utility that will allow me to change PO files from
TFS exposes a commmand line utility which covers most of the areas. However I
MyObject myObject = repositoryHibernateImpl.getMyObjectFromDatabase(); //transaction is finished, and no, there is not an option
Is there a look-and-feel-independent way to align a component (e.g. a JLabel ) horizontally
I'm trying to access the Application State from a utility class in the web
I maintain a Django project with a database that has several model constraints that
I’ve been working on a mapping project to display service orders for a utility
If I create a utility project and multiple dynamic web projects within Eclipse and
While browsing the code of an erlang application, I came across an interesting design
Before my app was on Heroku and used mysql gem. When I migrate that

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.