|
|||||||
New to SitePoint Forums? Register here for free!
|
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() 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. |
|
|
|
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 01:44.









Threaded Mode