Sublime Forum

Regex [:print:] not recognized or working

#1

I have a multiline search that was working before the new regex engine, but does not work now. I think the issue is that the engine is not correctly recognizing [:print:]. My search is:

(^FEATURE\s+\S+\s+\S+\s+\S+\s+27-mar-2109.+[\n[:print:]]*?\w)\n

Anyone else having this issue?

0 Likes

#2

Are you using this in the Find panel, or in a syntax?

0 Likes

#3

This is from the find and replace panel.

0 Likes

#4

FYI. The search and replace works if I give character range of [\x0-x7f] instead of [\n[:print:]]

0 Likes

#5

I tried using that regex on the following text, and it seemed to work fine.

FEATURE 1 2 3 27-mar-2109 this is a test of :print: a


0 Likes

#6

Your example is a little bit strange cos [[:print:]] is an array of printable char., not the string :print: itself, but at the end it doesn’t matter cos it works whatever printable char. you put to replace :print:.
At least with ST version 3102.

0 Likes

#7

It’s not a string…its a character class. I am looking across multiple lines, so any any printable character [:print:] as well as carriage return, [\n[:print:]]. I have worked around this with using an ASCII character class that does the same thing: [\x00-\x7f]. Either way, the [:print:] character class is not working, and there have been two other regex character classes that did not work that have been recently fixed, specifically: [[:blank:]] and [[:space:]], hence why I reported this as I think its related.

0 Likes

#8

So, here is the interesting thing. The regex does not work if you open the file and try to search with the regex; however, if you copy/paste the file to a new buffer, then the regex works. Why is that?

0 Likes

#9

Oh, here is an example of what I am searching:

FEATURE 21900 cdslmd 9.2 27-mar-2109 4 FE78F26C4868442A6544 \
         VENDOR_STRING=UHD:PERM DUP_GROUP=UHD vendor_info=12-feb-2016 \
         ISSUER=CDNS22f236a5eeb8a6c4582d5dfede638874 ISSUED=12-feb-2016 \
         SN=2016-02-12T06:57:07:862 START=12-feb-2016 SIGN2="1628 1B11 \
         966B 6E76 4BF1 864F 71D5 644A 8C3F 80AE 6F7E B0B3 0EDA 5104 \
         A6C9 18DB D39F 2CF5 6647 4BFB 0CD4 E53E F073 9BE6 CCFF 7AA0 \
         C270 281F 6E6D C8EE" V7.1_LK=3E3862EC820AC8CF6076 SORT=100
FEATURE Base_Verilog_Lib cdslmd 16.6 25-jun-2016 30 \
         DE28D2CC636B73FE955E VENDOR_STRING=UHD:PERM DUP_GROUP=UHD \
         vendor_info=12-feb-2016 \
         ISSUER=CDNS22f236a5eeb8a6c4582d5dfede638874 ISSUED=12-feb-2016 \
         SN=2016-02-12T06:57:07:862 START=12-feb-2016 SIGN2="017E DCF4 \
         B43B 2413 D55B 91E9 6CD4 310D 6038 39A5 7B2C 2114 BF74 1F77 \
         1B57 0442 135A 6123 6320 9189 BCBB BE4C 93A1 C5D1 BA0A ED1E \
         34B0 641D 5876 863E" V7.1_LK=AEA822DC2A747AEFEC66

The search should select FEATURE 21900 and all lines afterwards to the next feature, but not FEATURE Base_Verilog_Lib.

0 Likes

#10

Yes, I am aware it is a character class, I just wrote an english sentence that I could match against, and happened to use :print: in it. Sorry for the confusion!

The character class that you cited working was \x00-\x7f, which includes many non-printable characters. If you try paring that down, you may find there is some sort of non-printable character in there. That is my hunch, anyway.

0 Likes

#11

Base_Verilog_Lib has 25-jun-2016 in the first line while you match against 27-mar-2109 in your regex.

0 Likes