Skip to content

Commit 0aaee24

Browse files
committed
New script colorize_regex.pl: colorize highlight regex matches in chat messages
1 parent a8350f4 commit 0aaee24

File tree

1 file changed

+36
-18
lines changed

1 file changed

+36
-18
lines changed

perl/colorize_regex.pl

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
# SPDX-FileCopyrightText: 2025 ryoskzypu <ryoskzypu@proton.me>
2+
#
3+
# SPDX-License-Identifier: MIT-0
4+
#
5+
# License:
6+
# MIT No Attribution
7+
#
8+
# Copyright (c) 2025 ryoskzypu <ryoskzypu@proton.me>
9+
#
10+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
11+
# software and associated documentation files (the "Software"), to deal in the Software
12+
# without restriction, including without limitation the rights to use, copy, modify,
13+
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
14+
# permit persons to whom the Software is furnished to do so.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
17+
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
18+
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22+
#
123
# colorize_regex.pl — colorize highlight regex matches in chat messages
224
#
325
# Description:
@@ -22,24 +44,6 @@
2244
# History:
2345
# 2025-03-26, ryoskzypu <ryoskzypu@proton.me>:
2446
# version 1.0: initial release
25-
#
26-
# License:
27-
# MIT No Attribution
28-
#
29-
# Copyright (c) 2025 ryoskzypu <ryoskzypu@proton.me>
30-
#
31-
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
32-
# software and associated documentation files (the "Software"), to deal in the Software
33-
# without restriction, including without limitation the rights to use, copy, modify,
34-
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
35-
# permit persons to whom the Software is furnished to do so.
36-
#
37-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
38-
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
39-
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
40-
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
41-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
42-
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4347

4448
use strict;
4549
use warnings;
@@ -104,6 +108,7 @@
104108
(?> \o{032} | \o{033})
105109
[\o{001}-\o{006}]
106110
|
111+
<<<<<<< HEAD
107112
\o{031}\o{034} # Reset color and keep attributes
108113
/x;
109114
my $reset_rgx = qr/\o{034}/;
@@ -115,6 +120,19 @@
115120
($reset_rgx) # Reset all
116121
|
117122
# Bytes
123+
=======
124+
\o{031}\o{034} # Reset color and keep attributes
125+
/x;
126+
my $reset_rgx = qr/\o{034}/;
127+
my $split_rgx = qr/
128+
($colors_rgx) # Colors
129+
|
130+
($attr_rgx) # Attributes
131+
|
132+
($reset_rgx) # Reset all
133+
|
134+
# Bytes
135+
>>>>>>> 6669973 (New script colorize_regex.pl: colorize highlight regex matches in chat messages)
118136
/x;
119137

120138
# Space hex code.

0 commit comments

Comments
 (0)