Currently I am working on an function in which I want to tag certain parts of text.
This is what I have now :
Expand|Select|Wrap|Line Numbers
- case "djenter":
- var selection = str;
- if(selection){
- selection = selection.replace(/ /gi, ' ');
- selection = selection.replace(/\n/gi,']\n[dj=');
- selection = selection.replace(/\f/gi,']');
- selection = selection.replace(/\r/gi,']');
- selection = selection.replace(/\)\]/gi, '\)');
- selection = selection.replace(/ \(/gi, '\] \(');
- selection = selection.replace(/ \]/gi, '\]');
- selection = selection.replace(/\[dj=hosted by /gi, "Hosted by [dj=").replace(/\[dj=live : /gi, "LIVE : [dj=").replace(/\[dj=live /gi, "LIVE [dj=").replace(/\ vs. /gi, "] vs. [dj=").replace(/\ vs /gi, "] vs [dj=").replace(/\ aka /gi, "] aka [dj=").replace(/\ \& /gi, "] \& [dj=").replace(/\[dj=dj /gi, "dj [dj=").replace(/\[dj=mc /gi, "mc [dj=").replace(/\ live]/gi, "] LIVE");
- bbcode.insertAtCursorEx("[dj=" + selection,"]",select_flag);
- }else{
- alert("Je dient wel eerst een selectie te maken van DJ's welke geslitst worden doormiddel van een ENTER");
- }
- break;
------------------------
Reload-R & D-Ablo
Masochist & Re-Style
D-Spirit & Sceletor
The Viper & Partyraiser
J:D:A:
Evil Activities
Paul Elstak & MC Ruffian
Endymion & Nosferatu
Dione & Headbanger
Angerfist
Tommyknocker & Bike
Outblast & Catscan
Vinyl Junk
Vince
------------------------
Into the following :
------------------------
[dj=Reload-R] & [dj=D-Ablo]
[dj=Masochist] & [dj=Re-Style]
[dj=D-Spirit] & [dj=Sceletor]
[dj=The Viper] & [dj=Partyraiser]
[dj=J:D:A:]
[dj=Evil Activities]
[dj=Paul Elstak] & mc [dj=Ruffian]
[dj=Endymion] & [dj=Nosferatu]
[dj=Dione] & [dj=Headbanger]
[dj=Angerfist]
[dj=Tommyknocker] & [dj=Bike]
[dj=Outblast] & [dj=Catscan]
[dj=Vinyl Junk]
[dj=Vince]
------------------------
The above works fine, but I would like it also to be possible to let the function beable to exclude the time values in the example below :
22:00 – 22:45 Reload-R & D-Ablo
22:45 – 23:30 Masochist & Re-Style
23:30 – 00:15 D-Spirit & Sceletor
00:15 – 01:00 The Viper & Partyraiser
01:00 – 01:30 J:D:A:
01:30 – 02:15 Evil Activities
02:15 – 03:00 Paul Elstak & MC Ruffian
03:00 – 03:45 Endymion & Nosferatu
03:45 – 04:30 Dione & Headbanger
04:30 – 05:00 Angerfist
05:00 – 05:45 Tommyknocker & Bike
05:45 – 06:30 Outblast & Catscan
06:30 – 07:15 Vinyl Junk
07:15 – 08:00 Vince
So the time values are ignored and only the names after the times are tagged the same way as given in the first example.
If tried different ways using the \d{2}\:\d{2} - \d{2}\:\d{2}/gi method but can't seem to get it to work.
Can anybody help me on my way?
Kind regards and thanks in advance!