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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:06:26+00:00 2026-05-29T04:06:26+00:00

I have a list of items that are in this format: 05/01 – Some

  • 0

I have a list of items that are in this format:

05/01 – Some Basic: Text Here (Alpha, Bravo, Charli)

The first part is a date, then its always followed by a – . Then some text which represents a title or location of some sort and then some keywords that may or may not be in the parentheses.

I want to be able to extract the $month the $day the $title (including any colons) and the $keyword1 $keyword2 $keyword3 if they are there. Then assign them all to individual variables like the ones I’ve created so I can add them into my database. Getting it to do one of these at a time would be a great start but ultimately I want to be able to paste in multiple items in that format(without any spaces or characters to mark the difference besides whats already there) and be able to bulk extract them.

I’ve tried to use Preg_Match_all and things like stristr() but am having difficulty. I don’t really understand how to use them to get the specific parts.
For example

$month = stristr($listItem, '/', true);

echo"$month<br />";

$preDay = stristr($listItem, 'The', true);
echo"$preDay<br />";

$day = stristr($preDay, '/', false);
echo"$day<br />";

This only outputs this:

05

05/01 –

/01 – 

^ I can’t have the / or any weird –.

Actual code and an explanation of how to do this would be awesome! If you are using pregmatch I would really appreciate a breakdown of how your filtering this. Thank you much.

  • 1 1 Answer
  • 1 View
  • 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-29T04:06:27+00:00Added an answer on May 29, 2026 at 4:06 am

    The easiest way is using explode().
    The explode() function provides a fast way to break strings into arrays. See the manual: http://php.net/manual/pt_BR/function.explode.php

    With this format of string, you can break it into an array as follows.

    $string = '05/01 - Some Basic: Text Here (Alpha, Bravo, Charli)';
    $array = explode('-',$string);
    $date = $array[0]; //Date 05/01
    
    $array= explode('(',$array[1]);
    $title = $array[0];
    $tags = $array[1];
    
    //Now you have
    $date = '05/01';
    $title = 'Some Basic: Text Here';
    $tags = 'Alpha, Bravo, Charli)';
    
    //Notice that the first parenthesis of tags was exploded.
    //This is valid if and only if you have your string in the format
    // [date] - [title] ([tags]
    

    I don’t know if this is the best way but it works. You can also try using preg_split() function. This function makes a split using regular expressions. If you need help on regular expressions see http://www.phpf1.com/tutorial/php-regular-expression.html

    EDIT 1 I noticed that you string contains this symbol “–” after the date. This is not a hyphen as I know it. I use the minus signal to write it on my keyboard.

    Your simbol / mine = –-
    They are a little bit different.

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

Sidebar

Related Questions

I have a list of items that I need to update on different intervals.
I have a list of items that are displayed using a ListView from a
I have a list of items that a user can add to by clicking
I have a list of items that are created from the results of website
I am creating an application that will have a list of items that can
I have a dynamic list of items that will be used to POST information
I have a list of un ordered items.In that list of items the clicked
I have a Silverlight 2.0 DataGrid that contains a list of items that needs
I have a List that contains items, for example: 1) https:\\10.12.23\\ 2) https:\\12.23.12.25\\ 3)
I have a list of items on my web page that the user can

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.