473,386 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

preg_replace question

Hi all,

I would like to use preg_replace to add a space after normal interpunction in a message (to change "end of sentence.Begin" to "end of sentence. Begin").

However, obviously I do not want that within "words" that contain www, i.e. within URL's.

Anyone any suggestions?

Doing it the hard way, for example via manual checking of the string using strpos and so on, I can do. I just wonder if there is a preg_replace solution for this type of problem.

Thanks!
Oct 15 '07 #1
1 938
pbmods
5,821 Expert 4TB
Heya, Merlin.

The only thing I can think of would be that a new sentence is defined by a period followed by a capital letter:
Expand|Select|Wrap|Line Numbers
  1. s/\.([A-Z])/. \1/
  2.  
Oct 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: JDJones | last post by:
Just want to verify. I have a form and I want to parse any semi-colons out of the submitted info and replace with commas. Would this be the correct way to do it? $question1 = preg_replace(";",...
1
by: yawnmoth | last post by:
say i have the following script: <? $test = "aaaaa"; print '"' . preg_replace('/.*/','x',$test) . '"<br>'; $test = "\n\n\n\n\n"; print '"' . preg_replace('/.*/','x',$test) . '"'; ?> the...
7
by: Margaret MacDonald | last post by:
I've been going mad trying to figure out how to do this--it should be easy! Allow the user to enter '\_sometext\_', i.e., literal backslash, underscore, some text, literal backslash, underscore...
4
by: leegold2 | last post by:
preg_replace(","," ",$kw_str2); This does not replace commas with spaces. What am I doing wrong? Thanks, Lee G.
9
by: ihatzi | last post by:
Hey all! I am having a bit of trouble getting this to work. You all are probably familiar with the code that strips HTML tags: $PageText = preg_replace("/<.+?>/","",$WebPage); What I need...
3
by: Charles | last post by:
I'm new to this regular expression stuff. I'd like to use preg_replace to eliminate a known multi-line signature from the body of an E-mail. Say the body text is in $body, and the sig is this ...
5
by: julianmlp | last post by:
I'm fairly new to regex code, and I'm trying to find a way to replace any text after "///" (three slashes) and before a "\n" character. I've tried with: $filen = preg_replace("///./\n$", "",...
1
by: otrWalter | last post by:
I have a very specific need. Too long to get into what and why here (If you please). I have this test code... $_str = "testing that'S supposed to work!"; // Notice the CAP 'S, this is the...
10
by: deko | last post by:
I need to capture referrers to a website and populate a page with links to the referring pages. How do I use preg_replace to search for and replace all ampersands ('&') with the corresponding...
8
by: erikcw | last post by:
Hi all, I'm trying to write a regex pattern to use in preg_replace. Basically I want to put around every line (\n) in this variable. However, I need to exclude lines that already have brackets...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.