473,413 Members | 1,755 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,413 software developers and data experts.

PHP multiple preg_replace with multiple Regex conditions?

1
I want a expression that replaces more than 2 newlines and more than 4 spaces with 2 newlines / 1 space.

Now I have a working regex expression: "{5,}|^\n{2,}":

But now I have a problem: In PHP I have to say what I want it to replace with and as I have multiple replaces I have to have multiple preg_replaces.

Could anyone please make a preg_replace with the regex above and replace it with the statements above? (I dont know that much Regex, sorry)

Thanks very much!
Best reguard,
Tobi
Mar 7 '21 #1
0 2153

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

Similar topics

10
by: Rich Kucera | last post by:
Holding all versions at 5.0.4, Multiple stacks with multiple-version configurations inevitable Will have to wait to see what the impact of problems such as http://bugs.php.net/bug.php?id=33643 ...
6
by: Talin | last post by:
I've run in to this problem a couple of times. Say I have a piece of text that I want to test against a large number of regular expressions, where a different action is taken based on which regex...
3
by: Hrvoje Niksic | last post by:
I often have the need to match multiple regexes against a single string, typically a line of input, like this: if (matchobj = re1.match(line)): ... re1 matched; do something with matchobj ......
3
by: | last post by:
I'm seeking (probably basic) guidance on the right way to split a large site that's supposed to represent one domain(mydomain.org) into many small VS.NET projects, and how to avoid issues with...
6
by: Jankie | last post by:
Hi all ! I hope someone help me with problem that I assume common,yet googling didnt even mention it. In brief: User uploads multiple files at one go. It is one submission of multiple files,so I...
3
by: hunna03 | last post by:
Hey, I'm trying to run multiple WHERE statements in a single query but it's not working out. How would I do this? $q1=("SELECT * FROM roster WHERE (Position<='4' AND Terminated='0') ORDER BY...
3
by: DragonLord | last post by:
Ok here is the situation in detail. Single form with multiple items on it, 4 of which are panls that contain radio butons. Each panel loads it's radio buttons from a list of items in a sql...
3
by: omar999 | last post by:
im trying to figure out a way to query sql table several times within the same asp statement. as opposed to opening a new asp statement each time to query sql table again & again etc so this is...
1
by: Lyn DeMaio | last post by:
I've been tasked with taking two unrealted tables (Providers and Patients, no common field) and allow users, on one form (or form/subform) to search multiple fields in each table, select a record...
0
by: Allend | last post by:
I have a great little script that will search a file and replace a list of words with their matching replacement word. I have also found a way to prevent preg_replace from replacing those words if...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.