Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Unexpected ereg_replace when trying to match newline
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
DuCakedHare  
View profile  
 More options Jun 4, 6:18 am
From: DuCakedHare <dch....@googlemail.com>
Date: Thu, 4 Jun 2009 03:18:00 -0700 (PDT)
Subject: Unexpected ereg_replace when trying to match newline
Hi,

In PHP 5.2.6 : I'm trying to replace any dot character found at the
start of a line with two dots.

Since I cannot find a way to make ^ match newlines within a string, I
am doing:

ereg_replace('(\r|\n)\.','\1..',"first line\r\n.\r\nsecond line");

This however still seems not to match - the dot is never replaced.

I believe the regex is constructed correctly, and even so basic, I
still cannot determine what is wrong...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
DuCakedHare  
View profile  
 More options Jun 5, 9:40 am
From: DuCakedHare <dch....@googlemail.com>
Date: Fri, 5 Jun 2009 06:40:00 -0700 (PDT)
Subject: Re: Unexpected ereg_replace when trying to match newline
I solved it on my own.

ereg family does not use the extended features of grep.

I also had problem where replacing whitespace using \s would replace
's' characters instead.

Instead, use preg family and all seems to work.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google