473,698 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Removing line break character and space from form data

4 New Member
Hi all,

Tricky question. I know how to remove line break characters and spaces by
using the code below:


$message =~ s/\n//g;
$message =~ s/\s//g;


........... how do you do it if you do not want to remove the first line break??? - but then remove the rest. So in other words, you want to skip the first line break.

Thanks in advance,
mccalla
Oct 30 '08 #1
1 4623
KevinADC
4,059 Recognized Expert Specialist
There will be a number of ways to do this. Heres one way:

Expand|Select|Wrap|Line Numbers
  1. $message =~ s/\n/[n]/;
  2. $message =~ s/\n//g;
  3. $message =~ s/\[n\]/\n/;
  4.  
Oct 30 '08 #2

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

Similar topics

12
3279
by: dan glenn | last post by:
Hi. I'm finding that if I have text entered into a <textarea ...> </textarea> in a form, and that text has leading blank lines (with no spaces or anything else), that when I retrieve the entered text, I lose the leading blank line. Each time it goes through a post any top-leading blank line is lost. Only one- if I have several blank lines in a row at the top, only the first is lost. (If the top blank line has a single space, it's handled...
5
2266
by: Mechphisto | last post by:
I'm using a textarea to insert some notes into a database. It's inserting the complete result into the mySQL table including the linebreaks...and not as a visible symbol but an actual linebreak. If I select the fireld in mySQL at a command prompt, the results take an inordinate amount of space from all the linebreaks. I tried nl2br() before it goes into the INSERT, but all that does is ADD <br /> to the data but it still have linebreaks...
5
13118
by: Jonathan Daggar | last post by:
Hello, I'm trying to put together a form with a very tight table formatting. However, every time I put an text-type input field in, the browser pads the area to the right of it with space. I've tried to eliminate it several ways, but it won't go away. It looks like it's forcing at least one space (line break?) in after each field, and then there's some mystery padding on the right that also refuses to go away. I've put up a demo of...
10
11454
by: Steve | last post by:
I'm not sure if I should be using tables here to structure the layout or if CSS is okay. I have a data entry form in which I have floated the labels to one side, and given them a specific width. With regular input such as textboxes, everything lines up fine. The problem I'm having is that I have an unordered list of checkboxes, and only the first item will line up with the label. The additional checkboxes and their labels end up being...
6
1165
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 { white-space: pre-wrap; /* css-3 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */
4
6318
by: tcfin | last post by:
Hi, i have a problem to make a transtype from field XX varchar(20), example : 19 200 340,56 to field YY integer, required : 19200340
6
24570
by: McKirahan | last post by:
I an using ASP to read a database table and generate an HTML table which is save via FSO with a file extension of .xls which opens up in MS-Excel. I am inserting several lines of text into a cell and would like to force a line break between them. I recorded an MS-Excel macro so see how Alt-Enter was captured which turned out to be Chr(10) which is the same as vbLf (right?) I tried inserting that in character in the text but it didn't...
16
38614
by: junky_fellow | last post by:
Is there any efficcient way of removing the newline character from the buffer read by fgets() ? Is there any library function that is similar to fgets() but also tells how many bytes it read into the buffer ?
8
41777
Chittaranjan
by: Chittaranjan | last post by:
Hi All, I am using perl to get the data from the form fields and I have a text area from where if some one enters data like below: "This is test And this is also test This is also test." So here you can notify the text is entered with hitting of enter key to have the line break. But I am having the problem while saving the data entered in this field in a text file then there also it is saving with these line breaks(new lines) so if am...
0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9171
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
5869
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2342
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.