SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Table 4: PCRE syntaxes supported in this paper.
Syntax	Description
α	Matches a single character.
αβ	CONCAT operation. Matches αβ.
α|β	OR (|) operation. Matches α or β.
α*	Kleene (*) star. Matches α zero or more times.
.	Wildcard. Matches any character.
α+	PLUS (+) operation. Matches α one or more times.
ˆα	Matches α only appears at the beginning of the string.
$α	Matches α only appears at the ending of the string.
[α-β]	Character class. The character class uses the OR operation to match a character included in the character class.
α{β,δ}	Range Matching. Matches α subexpression β to δ times.
α{β,}	AtLeast Matching. Matches α subexpression β or more times.
α{β}	Exactly Matching. Matches α subexpression β times.
\d	Matches any number, equivalent to [0-9].
\D	Matches any non-number.
\w	Matches any letter, equivalent to [a-zA-Z].
\W	Matches any non-letter.
\s	Matches any non-whitespace character.
\S	Matches any whitespace character.
B The PDF and CDF of matched abnormal packet segment lengths
(a) PDF
Figure 5: Matched abnormal packet segment lengths statistics.
(b) CDF
C The average F1-Scores of DFA2BRNN and BRNN2PSRF
Table 5: The average F1-Scores of DFA2BRNN with a ratio of normal/abnormal traffic of  ${99}\% /1\%$  .
Method	0%	1%	10%	100%
LSTM	51.04	83.29	91.95	96.84
CNN	48.50	91.81	94.19	97.47
DAN	49.92	63.24	75.06	82.30
BRNN	85.19	94.33	98.42	99.35
Table 5 and Table 6 show the average F1-Scores of DFA2BRNN and BRNN2PSRF with a ratio of normal/abnormal traffic of  $99\% /1\%$ , respectively. Note that columns represent # TD. Our BRNN and
Table 6: The average F1-Scores of BRNN2PSRF a ratio of normal/abnormal traffic of  ${99}\% /1\%$  .
Method	0%	1%	10%	100%
DT	-	69.32	78.59	86.10
RF	-	77.20	84.93	87.41
Hard DT	76.74	85.88	86.30	87.15
Hard RF	77.46	85.79	86.58	87.00
SRF	77.46	90.94	91.12	92.28
PSRF	84.38	94.75	95.90	97.83
PSRF achieve 99.35 and 97.83 F1-Score, respectively. This is because only a very small portion of real-world traffic contains long RE patterns. As such, BRNN and PSRF can detect most of the RE patterns in real-world traffic.
Table 7: The average F1-Scores of DFA2BRNN with a ratio of normal/abnormal traffic of  ${50}\% /{50}\%$  .
Method	0%	1%	10%	100%
LSTM	49.73	81.67	90.67	95.12
CNN	50.28	90.55	92.64	95.79
DAN	49.16	62.09	73.84	80.78
BRNN	84.47	94.01	98.30	98.26
Table 8: The average F1-Scores of BRNN2PSRF with a ratio of normal/abnormal traffic of  ${50}\% /{50}\%$  .
Method	0%	1%	10%	100%
DT	-	68.01	77.12	85.05
RF	-	75.78	83.56	86.20
Hard DT	75.32	84.11	84.19	85.07
Hard RF	76.22	84.46	85.30	85.63
SRF	76.22	88.31	89.91	91.03
PSRF	83.94	93.22	94.55	97.37
Table 7 and Table 8 show the average F1-Scores of DFA2BRNN and BRNN2PSRF with a ratio of normal/abnormal traffic of  $50\% / 50\%$ , respectively. Note that columns represent # TD. We find that our BRNN and PSRF achieve similar F1-Score 98.26 and 97.37 compared with the results of former experiments, respectively. The reason is that the RE patterns in the real-world traffic are relatively fixed, and are only a subset of the Snort.
D Experiment results on network intrusion detection
Table 9: The accuracy of DFR and PSRF on network intrusion detection.
Method	0%	1%	10%	100%
RE	77.84	77.84	77.84	77.84
DFR	49.62	71.05	81.19	98.71
PSRF	75.96	78.41	83.55	98.37
Table 9 shows the accuracy of DFR (Zeng et al., 2019) and PSRF on network intrusion detection using the UNB ISCX IDS 2012 dataset. Note that columns represent # TD. PSRF achieves  $77.84\%$  accuracy while DFR only performs random guesses in the zero-shot scenario. In few-shot scenarios, PSRF also demonstrates superior accuracy over DFR. For full training, PSRF achieves  $98.37\%$  accuracy while DFR  $98.71\%$  accuracy.