473,406 Members | 2,259 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,406 software developers and data experts.

Regexp to force line break/word wrap in long words

Hi Can someone please give me a hand adapting this expression? I need
it to add a space into all words longer than 14 characters that are
not contained within [square brackets]

$result = preg_replace("/([^\s]{14})/","$1 ",$result);

It currently adds a space into all words that are longer than 14
characters but this is breaking another function I'm using which
extracts urls and other info from inside square brackets.

Thanks a lot!
Ciarán
Dec 3 '07 #1
5 3915
Ciaran wrote:
Hi Can someone please give me a hand adapting this expression? I need
it to add a space into all words longer than 14 characters that are
not contained within [square brackets]

$result = preg_replace("/([^\s]{14})/","$1 ",$result);

It currently adds a space into all words that are longer than 14
characters but this is breaking another function I'm using which
extracts urls and other info from inside square brackets.

Thanks a lot!
Ciarán
I need more information to answer this, but no point in asking for it as I'm
sure in your expert view I have all Ineed!
Dec 3 '07 #2
Paul Lautman wrote:
>
I need more information to answer this, but no point in asking for it as I'm
sure in your expert view I have all Ineed!
;-)

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Dec 4 '07 #3
On Dec 3, 10:12 pm, "Paul Lautman" <paul.laut...@btinternet.com>
wrote:
I need more information to answer this, but no point in asking for it as I'm
sure in your expert view I have all Ineed!
Really?? What other information would you like? or were you just
trying to be condescending?
Dec 4 '07 #4
On Dec 5, 2:48 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
>
No, just truthful. After several requests from different users, you
told us in comp.databases.mysql you didn't see why we would need any
more information to solve your problem.
Jerry, Please be assured that I meant no offence to you or anyone else
over on the mysql newsgroup. You personally have been of great help to
me in the past and I am very thankful and respectful for that. I've
looked again at all the replies on the mysql topic and if you look
again you will see that I was nothing but polite and responsive until
I was asked to explain the table design repeatedly. I was looking for
a quick solution to a simple problem. The reason I did not give more
info initially was because I didn't want to start a long discussion on
the way my tables were laid out - I simply wanted help with the syntax
of the query. From experience posting to these newsgroups, I know that
giving too much superfluous info can lead to very delayed solutions as
eager purists discuss the most efficient way to do things. I usually
only post here to find handy solutions to problems I cannot fix and
occasionally to help beginners in similar situations. I was impatient
- I apologise and I do appreciate your time.
Ciarán
Dec 6 '07 #5
Ciaran wrote:
On Dec 5, 2:48 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
>>>No, just truthful. After several requests from different users, you
told us in comp.databases.mysql you didn't see why we would need any
more information to solve your problem.

Jerry, Please be assured that I meant no offence to you or anyone else
over on the mysql newsgroup. You personally have been of great help to
me in the past and I am very thankful and respectful for that. I've
looked again at all the replies on the mysql topic and if you look
again you will see that I was nothing but polite and responsive until
I was asked to explain the table design repeatedly. I was looking for
a quick solution to a simple problem. The reason I did not give more
info initially was because I didn't want to start a long discussion on
the way my tables were laid out - I simply wanted help with the syntax
of the query. From experience posting to these newsgroups, I know that
giving too much superfluous info can lead to very delayed solutions as
eager purists discuss the most efficient way to do things. I usually
only post here to find handy solutions to problems I cannot fix and
occasionally to help beginners in similar situations. I was impatient
- I apologise and I do appreciate your time.
Ciarán
The problem was, the question you were asking required the tables design
to provide a good answer. And that's why you were asked for it
repeatedly, by multiple people.

Giving too much information is seldom bad. Not enough is *always* bad.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Dec 6 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Anand Pillai | last post by:
To search a word in a group of words, say a paragraph or a web page, would a string search or a regexp search be faster? The string search would of course be, if str.find(substr) != -1:...
3
by: Adam | last post by:
Hello is there a function in ASP that can force a database result to automatically wrap at say.. 25 characters in length? Reason for this is because I have a database and people could go in and...
11
by: name | last post by:
Here is a first attempt at a line/word wrapping utility. Seems to work okay, but lacks some checking stuff, etc. --------------------------------------------------------- #include <stdio.h>...
3
by: mg | last post by:
How can I get a long Label1.Text to wrap within a WebForm (C#)?
8
by: Frost | last post by:
Hi All, I am a newbie i have written a c program on unix for line by line comparison for two files now could some one help on how i could do word by word comparison in case both lines have the...
6
by: Markus Ernst | last post by:
Hi Searching for a possibility to display some text with preserved white space and line breaks, but with long lines being wrapped, I found this CSS declaration, which I found helpful: pre {...
9
by: howarthc | last post by:
OK - here is what I want to do - but I am lost how to do it. I have a variable $mystring = "one two three four five six seven eight nine" This variable $mystring can be 4 words long or it...
4
by: eight02645999 | last post by:
hi suppose i have a string like test1?test2t-test3*test4*test5$test6#test7*test8 how can i construct the regexp to get test3*test4*test5 and test7*test8, ie, i want to match * and the words...
3
by: mithunm | last post by:
Hi, Currently i am facing a problem if my <td>***</td> contains value like aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa or something is better than nothing and we all know that then...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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...

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.