Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Regex for dl/dt/dd or table

Quote Reply
Regex for dl/dt/dd or table
I have a field text; there i have something like

blabla, blabla

Monday: 10-12
Tuesday:12-14
...
Sunday: 10-19

blablabla

I also use bbcodes like b or i in my text.

Then i have a global like

Code:
sub {
my ($rec) = @_;
my $d = $rec->{Text};
utf8::encode($d);

$d = GT::CGI::html_escape($d);
$d =~ s,\[(/?b)\],<$1>,g;
$d =~ s,\[(/?B)\],<$1>,g;
return $d;
}

Now i would like to do something like this:

[table]
Monday: 10-12
Tuesday:12-14
...
Sunday: 10-19
[/table]

My global should take everything between [table] and [/table] and substitue like this:
<table> then for all lines
New line start = <tr><td>
: = </td><td>
Line end = </td></tr>
end lines
</table>

the same should go with dl, dt, dd, i think. But i have no idea how todo it. May someone has an idea?
Subject Author Views Date
Thread Regex for dl/dt/dd or table Robert 7173 Dec 4, 2017, 8:34 AM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 7072 Dec 5, 2017, 12:23 AM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 7063 Dec 5, 2017, 3:00 AM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 7058 Dec 5, 2017, 4:15 AM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 7057 Dec 5, 2017, 6:11 AM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 7051 Dec 5, 2017, 7:03 AM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 7042 Dec 5, 2017, 2:35 PM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 7027 Dec 5, 2017, 11:58 PM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 6973 Dec 7, 2017, 4:19 AM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 6960 Dec 7, 2017, 10:45 AM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 6962 Dec 7, 2017, 11:14 AM
Post Re: [Robert] Regex for dl/dt/dd or table
Robert 6946 Dec 7, 2017, 12:21 PM