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 489611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:49:32+00:00 2026-05-13T01:49:32+00:00

I have been fiddling with this for almost an hour and am getting nowhere.

  • 0

I have been fiddling with this for almost an hour and am getting nowhere. Regexes are not my strong suit.

I have data like the following:

.cke_button_about .cke_icon { background-position: 0 -76px; }
.cke_button_maximize .cke_icon { background-position: 0 -108px; }

I need to replace the vertical values (-76px and -108px) using preg_replace_callback(). The callback function is written, but I can’t for the life of me get the numbers out properly.

This works fine for 4-digit numbers:

preg_replace_callback("/(background\-position\:)(.*)(\d{4})(px)/", "recalculate",
$css_string);

but how can I make it so it recognizes any kind of number? {1-4} should work but somehow conflicts with the first, horizontal value.

Would anybody like to help me out?

Thanks in advance.

  • 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-13T01:49:33+00:00Added an answer on May 13, 2026 at 1:49 am
    /(background\-position\:)(\D*\d*\D*)(\d+)(px)/
    

    Gets what you want while preserving the current capturing groupings.

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

Sidebar

Related Questions

I Have been fiddling with this for hours. I can not get my text
I've been fiddling with this HTML and javascript for an hour or two now...and
I have been fiddling with this issue all day now. I need to create
This is probably painfully easy to solve but I have been fiddling with it
I have this, and i've been fiddling around with it for a while but
I have been fiddling around with server side interceptors on CXF. But is seems
I have been fiddling with code to call a function with the name of
Have been working on this question for a couple hours and have come close
I have a list of items that can be represented like this: ClientNo Name
I am just learning C# (have been fiddling with it for about 2 days

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.