• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Regular Expression Replacement

Guest
May 15, 2007 May 15, 2007

Copy link to clipboard

Copied

I have a replacement string of the form "[\1\2]='\3'," and I'd like to insert a carriage at the end of the string. I've tried \n, \r\n and it doesn't seem to work.
TOPICS
Advanced techniques

Views

479

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 15, 2007 May 15, 2007

Copy link to clipboard

Copied

is the CR for outputting the result on html-type page or for storing in
db/text file?

for html-type: add <br>
for db/text: try #chr(10)# or #chr(13)# or both together. one of them is
LF another is CR - can't recall which one is which...

--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 16, 2007 May 16, 2007

Copy link to clipboard

Copied

Chr(10) is newline, Chr(13) is carriage return. BTW, do we all know what a carriage is? 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 16, 2007 May 16, 2007

Copy link to clipboard

Copied

jdeline wrote:
> Chr(10) is newline, Chr(13) is carriage return. BTW, do we all know what a carriage is? :-)

sure! it's a 4-wheel horse-drawn transportation device! apparently it
can be returned... presumably if you do not want it any more or if it
has become outdated... anyone knows WHERE they are returned to? :)

--
Azadi Saryev
Sabai-dee.com
Vientiane, Laos
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
May 16, 2007 May 16, 2007

Copy link to clipboard

Copied

Obviously, all carriages are returned to the wonderous place of "Line Feed", which explains why you actually want to use #chr(13)##chr(10)# instead of vice versa.

Also, if that doesn't work for you, you can probably also just hit the enter key after your replacement string:

<cfsavecontent variable="sReplacePattern">[\1\2]='\3'
</cfsavecontent>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 16, 2007 May 16, 2007

Copy link to clipboard

Copied

LATEST
Thanks for the help. I'll give those ideas a try. In answer to the question, I'm copying data off of a website page with the clipboard and pasting it into a textarea and then running some CF with regex to build queries to update a database. So I just wanted to insert a line feed at the end of a string so that the next regex expression could get all that I wanted it to get with the beginning of string alignment ^.
Again thanks for the help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation