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 4336 Dec 4, 2017, 8:34 AM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 4290 Dec 5, 2017, 12:23 AM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 4282 Dec 5, 2017, 3:00 AM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 4278 Dec 5, 2017, 4:15 AM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 4274 Dec 5, 2017, 6:11 AM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 4271 Dec 5, 2017, 7:03 AM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 4261 Dec 5, 2017, 2:35 PM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 4246 Dec 5, 2017, 11:58 PM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 4189 Dec 7, 2017, 4:19 AM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 4179 Dec 7, 2017, 10:45 AM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 4178 Dec 7, 2017, 11:14 AM
Post Re: [Robert] Regex for dl/dt/dd or table
Robert 4171 Dec 7, 2017, 12:21 PM