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 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 an application or utility that will convert LINQ to Lambda Expressions? (or
Is there a utility out there that will convert an arbitrary (or at least
Is there a free utility that will fill up your database tables with test
Is there an app or utility that will allow me to view ADB output
Is there a utility out there that will create VB.NET classes from a Dataset.xsd
Is there a gettext utility that will allow me to change PO files from
Is there a utility that will encrypt a named configuration section (or just the
Is there a utility that will generate html or css for blocks of code
Is there any utility that will copy the official build of a windows forms
I was wondering ( if possible ) if there was a program/tool/utility that when

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.