Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2

Thread: regex problem

  1. #1
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    I have a string that is the result of a lot of regex manipulations.

    The preceding regex'es have produced something similar to the following result:

    Code:
    Th 25 may F Fr 26 may BGO 1554 OSL 1640 Sa 27 may F Su 28 may GO Mo ....
    The question is;
    How do I replace (with preg_replace) the space between weekdays with a <br /> tag so the output would read:
    Code:
    Th 25 may F
    Fr 26 may BGO 1554 OSL 1640
    Sa 27 may F
    Su 28 may GO
    Mo ...
    S. Rosland

  2.  

  3. #2
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    Never mind.
    Code:
    preg_replace("/\s+(Fr|Sa|Su|Mo|Tu|We|Th)/", "<br />\\1", $a);
    S. Rosland


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 06:08 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com