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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:52:48+00:00 2026-06-16T04:52:48+00:00

I have a line of code in my wordpress widget that outputs from an

  • 0

I have a line of code in my wordpress widget that outputs from an RSS feed:

<?php echo $entry->title ?>

and when displayed it looks like:

$220,000 :: 504 Freemason St, Unit 2B, Norfolk VA, 23510

or

$274,900 :: 1268 Bells Road, Virginia Beach VA, 23454

What is the easiest way to break this up into different objects?

For example, I’d like to have the price, street name, and city state zip in different objects. The problem is that some of the addresses have unit numbers and it’s complicating things. Below is an example of how I would like it to work:

<?php echo $entry->price ?>
<?php echo $entry->street ?>
<?php echo $entry->citystatezip ?>

$220,000
504 Freemason St, Unit 2B
Norfolk VA, 23510

or

$274,900
1268 Bells Road
Virginia Beach VA, 23454

  • 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-16T04:52:49+00:00Added an answer on June 16, 2026 at 4:52 am

    Here is a very crude regex that seems able to parse your string. I’m not the best with regexes, but it seems to work.

    /^(\$(?:\d{1,3},?)*) :: (\d* [\w\s,\d]*), ([\w\s]* \w{2}, \d{5})$/
    

    Use this with preg_match; the 1st group is the price, the 2nd is the address, and 3rd is the city/state/zip.

    Example:

    <?php
    $ptn = '/^(\$(?:\d{1,3},?)*) :: (\d* [\w\s,\d]*), ([\w\s]* \w{2}, \d{5})$/';
    if(preg_match($ptn, $entry->title, $match) === 1){
        $price = $match[1];
        $street = $match[2];
        $citystatezip = $match[3];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following line of code - <a href=/wordpress/wp-content/trackclicks/clickcounter.php?var=<?php echo $var3; ?> onclick=return
I have a simple RSS feed coming in my Wordpress site with php, but
I have been reading some WordPress PHP code on GitHub and I found that
I have a folder pulled from a wordpress installation, >1000 files. Some php code
I have a line of code that counts all attribute names that end in
I have a line of code that gets the following error when run through
So I have this line of code inside a WordPress plugin. The code file
I have an image that is left aligned with a caption in WordPress (code
I am talking about this line of code <link rel=alternate type=application/rss+xml title=example.com &raquo; Comments
In my root .htaccess file I have the following Wordpress code: RewriteRule ^index\.php$ -

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.