Go Back   SitePoint Forums > Forum Index > Program Your Site > General Development Issues
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old Jan 22, 2002, 14:46   #1
creole
SitePoint Wizard
 
creole's Avatar
 
Join Date: Oct 2000
Location: Nashvegas Baby!
Posts: 7,991
Regex questions

I don't how many other people thank GOD for Regex, but I do. It has saved me so much time since I started using them in coding.

I have a few questions though about usage. I did this the hard way, but now I wonder if there was an easy way. Let's say I have a page full of names like below.

B06
B09
B26

I want to end up with this:

<input type="checkbox" name="B06" value="checkbox">B06<br>
<input type="checkbox" name="B09" value="checkbox">B09<br>
<input type="checkbox" name="B26" value="checkbox">B26<br>

Note the name in the name="" field as well as before the <br> tag. I was able to use regex to position the <input tag itself by replacing the beginning character (^) with the full input tag, and the end character ($) with the <br>.

What I would have loved to do would be to "find" the name on that line and duplicate it to look like this:

B06 B06
B09 B09
B26 B26

I could have then regexed the rest instead of copying and pasting the name into the name="" field. I was messing around and did a F&R for "$$". It "replaced" every line but there was no change. So I assumed that it "found" the name on the line and replaced it with itself. Is this possible? If so that would be awesome if someone could enlighten me as to how it could be done or point me to a site which could show me how to learn it.

note: I'm using a plain old text editor (EditPlus) for this work.
creole is offline   Reply With Quote
 

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 01:44.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved