Regex for Naming Standard

REGEX for naming standards starting with a page order digits:

0001 Cover Sheet.PDF

0002 0.1 Erosion Control.Pdf

0003 1.0 Prelim Site_Plan.PDf

0011 Topographic Survey.pdf

Alt1:  (3-digit page order)

001 Cover Sheet.PDF

002 0.1 Erosion Control.pdf

003 1.0 Prelim

Alt2:  (DDD.DD page order)

001.05 Cover Sheet.PDF

4-digit page order examples

Four digits, one or two spaces, either a digit, period, digit, sheet title string OR a sheet title string alone, .PDF

Alt1: To change to  DDD [D.D] Title.pdf   (3 digits instead of four for page number order)  substitute ^\d{4} with ^\d{3

Alt2: To change to  DDD.DD [D.D] Title.pdf   (3 digits instead of four for page number order)  substitute ^\d{4} with ^\d{3}(\.\d{2}){0,1}

 

 

^\d{4}\s{1,2}((([a-zA-Z0-9]|\s|_){1,})|(\d\.\d\s{1,2}([a-zA-Z0-9]|\s|_){1,}))\.(p|P)(d|D)(f|F)$

For three digits instead of four (page order number)  – alternative pattern1

^\d{3}\s{1,2}((([a-zA-Z0-9]|\s|_){1,})|(\d\.\d\s{1,2}([a-zA-Z0-9]|\s|_){1,}))\.(p|P)(d|D)(f|F)$

For three digits instead of four (page order number)  – alternative pattern2

^\d{3}(\.\d{2}){0,1}\s{1,2}((([a-zA-Z0-9]|\s|_){1,})|(\d\.\d\s{1,2}([a-zA-Z0-9]|\s|_){1,}))\.(p|P)(d|D)(f|F)$

001 Cover Sheet.Pdf

001 G001 Cover Sheet.PDF

004 C0.0 Civil Notes.pdf

Three digits, one or two spaces, EITHER char and three digits a sheet title string, OR char, digit, period, digit sheet title string OR just a sheet title string alone, .PDF

Alt:  To set the char “c” in CDDD or CD.D pattern to a specified set allowed…  (example table)

 

Substitute [a-zA-Z] with ([ASMELCVasmelcv]|ID|id|Id|iD|SC|sc|Sc|sC|LS|ls|Ls|sL|FP|fp|Fp|fP)

^\d{3}\s{1,2}(([a-zA-Z]\d{3}\s{1,2}([a-zA-Z0-9]|\s|_){1,})|([a-zA-Z]\d\.\d\s{1,2}([a-zA-Z0-9]|\s|_){1,})|(\d\.\d\s{1,2}([a-zA-Z0-9]|\s|_){1,})|(([a-zA-Z0-9]|\s|_){1,}))\.(p|P)(d|D)(f|F)$

For specified discipline  – alternative pattern

^\d{3}\s{1,2}((([ASMELCVasmelcv]|ID|id|Id|iD|SC|sc|Sc|sC|LS|ls|Ls|sL|FP|fp|Fp|fP)[a-zA-Z]\d{3}\s{1,2}([a-zA-Z0-9]|\s|_){1,})| (\d\.\d\s{1,2}([a-zA-Z0-9]|\s|_){1,})|(([ASMELCVasmelcv]|ID|id|Id|iD|SC|sc|Sc|sC|LS|ls|Ls|sL|FP|fp|Fp|fP)\d\.\d\s{1,2}([a-zA-Z0-9]|\s|_){1,})|(([a-zA-Z0-9]|\s|_){1,}))\.(p|P)(d|D)(f|F)$

001 A000 Cover Sheet.pdf

002 a000 Code Analysis.pdf

004  A200  Overall Plan and Wall Types.pdf

004 A200 Overall Plan & Wall Types.PDF

004 a200 Overall_Plan_and_Wall_Types.pdf

See the source image

Three digits, one to two spaces, one character, three digits, one to two spaces, and sheet title string with characters, spaces, underbar, or &, .PDF

 

SEE NEXT ONE IN THIS TABLE FOR DDD.D or DDD.DD derivative (to accommodate inserted pages)

 

^(\d{3})((\.\d{1,2}){0,1})(\s{1,2})([a-zA-Z0-9]{1}\d{3})(\s{1,2}([a-zA-Z0-9]|\s|&|_){1,})\.(p|P)(d|D)(f|F)$

001 A000 Cover Sheet.pdf

002 a000 Code Analysis.pdf

002.05 a000 Code Insert page.pdf

004.5  A200  Overall Plan and Wall Types.pdf

004 A200 Overall Plan & Wall Types.PDF

004 a200 Overall_Plan_and_Wall_Types.pdf

See the source image

Three digits, optional period and one to two digits,  one to two spaces, one character, three digits, one to two spaces, and sheet title string with characters, spaces, underbar, or &, .PDF

 

^(\d{3})((\.\d{1,2}){0,1})(\s{1.2})([a-zA-Z0-9]{1}\d{3})(\s{1,2}([a-zA-Z0-9]|\s|&|_){1,})\.(p|P)(d|D)(f|F)$

101-D-104 detail floor1.pdf

101-D-1022_detail floor2.pdf

101-GA-101 general sheet.pdf

000-zZ-9999 sheet & title.pdf

Alt:  (3-digit page order and optional insert .DD)

0001-D-104 detail floor1.pdf

0001.05-D-105 detail additional floor1.pdf

0002-D-1022_detail floor2.pdf

0003-GA-101 general sheet.pdf

9999-zZ-9999 sheet & title.pdf

Three digits, one dash, one to two chars, one dash, three or four digits, space or underbar, a title string, .PDF

 

Alt: DDD.DD-CC-DDDD or  DDDD.DD-CC-DDDD

Three or four digits, optional period and 2 digits, one dash, one to two chars, one dash, three or four digits, space or underbar, a title string, .pdf

^(\d{3})(-)([a-zA-Z]){1,2}(-)(\d{3,4})((\s{1,2}|\_)([a-zA-Z0-9]|\s|&|_){1,})\.(p|P)(d|D)(f|F)$

For four-digit page order    alternative pattern

^(\d{3,4})(\.\d{2}){0,1}(-)([a-zA-Z]){1,2}(-)(\d{3,4})((\s{1,2}|\_)([a-zA-Z0-9]|\s|&|_){1,})\.(p|P)(d|D)(f|F)$

101-GA-1234 GROUND FLOOR GA.PDF

101-D-101 GROUND FLOOR DETAILS.PDF

101-d-102 First floor details.pdf

999-Z-999 Any string.pdf

999-Z-9999 Any string.pdf

000-A-0000 Any string.pdf

000-A-000 Any string.pdf

See the source image

 

Three digits, dash, two digits, dash, three to four digits, one or two spaces, title string,.pdf

ALT:  To convert the first and second char to a specific character set in table below ONLY…

Substitute:  ([A-Za-z])([A-Za-z]{0,1}) with

([ASPEMLVFHaspemlvfh]|EN|en|En|eN)

101-EN-0001 anystring.pdf

101-GA-1237 any string.pdf

^(\d{3})(-)([a-zA-Z]){1,2}(-)(\d{3,4})((\s{1,2}|\_)([a-zA-Z0-9]|\s|&|_){1,})\.(p|P)(d|D)(f|F)$

For specified discipline only A,S,P,E,M,L,V,F,H,EN,GA  – alternative pattern

^(\d{3})(-)([ASPEMLVFHaspemlvfh]|EN|en|En|eN)(-)(\d{3,4})((\s{1,2}|\_)([a-zA-Z0-9]|\s|&|_){1,})\.(p|P)(d|D)(f|F)$

000 Content.PDF

001  Submittal Checklist.PDF

003 Water Report.PDF

012 Grading Plan 6.PDF

012.1 Grading Plan Insert.PDF

016 SWPPP 1.pdf

Three digits, optional period digit, one to two spaces, title string,.pdf

ALT:  DDD.DD any string.pdf  (two digits for insert pages)

Substitute

(\.\d{1}) with (\.\d{2}

For either 1 or 2 digits, either DDD.D or DDD.DD use…

(\.\d{1,2})

012.15 Grading Plan Insert.PDF

 

^(\d{3})((\.\d{1}){0,1}\s{1,2}([a-zA-Z0-9]|\s|&|_){1,})\.(p|P)(d|D)(f|F)$

For two digits (both required) insert number  – alternative pattern 

^(\d{3})((\.\d{2}){0,1}\s{1,2}([a-zA-Z0-9]|\s|&|_){1,})\.(p|P)(d|D)(f|F)$

000 Cover.PDF

002 Code 1.pdf

004 C1.0 SITE PLAN.PDF

005  A1.0  floor plan.pdf

Limit file name to 40 characters.

ALT:

000.01 Cover.PDF

002 Code 1.pdf

004 C1.01 SITE_PLAN.PDF

005  A1.0  floor plan & detail.pdf

Three digits, one to two spaces, optional trade char (C,A,S,M,P,E) digit period digit, one to spaces, sheet title,.PDF

Filename limited to 40 characters.

Regex:  (?!.{41,})

Alt: 

DDD.DD title_string.pdf  or DDD.DD CD.DD title & string.pdf

Three digits, optional period and two digits, one to two spaces, optional trade char (C,A,S,M,P,E) digit period two digits, one to spaces, sheet title including underbar and &,.PDF

 

(?!.{41,}) ^\d{3}\s{1,2}(([CASMPEcasmpe]\d\.\d{1}\s{1,2}([a-zA-Z0-9]|\s){1,})|((c|C)(o|O)(v|V)(e|E)(r|R))|((c|C)(o|O)(d|D)(e|E)\s{1,2}\d))\.(p|P)(d|D)(f|F)$

For two digits insert option and 2 digits after trade digit period – alternative pattern 

(?!.{41,}) ^\d{3}(\.\d{2}){0,1} \s{1,2}(([CASMPEcasmpe]\d\.\d{1,2}\s{1,2}([a-zA-Z0-9]|\s|_|&){1,})|((c|C)(o|O)(v|V)(e|E)(r|R))|((c|C)(o|O)(d|D)(e|E)\s{1,2}\d))\.(p|P)(d|D)(f|F)$

001 G1 Cover Sheet.pdf

002 L1 Control Plan.PDF

001.1 A Third-floor Plan Insert.PDF

002.01 C Grading - Plan.pdf

001 AV01.04  Audio_visual & more.pdf

Three digits, optional period and one to two digits, one to two spaces, one to three discipline chars with one to two digits with optional period and one to two digits, space, sheet title string,.PDF

Filename limited to 50 characters.

Regex:  (?!.{51,})

To remove _ , -, or & in sheet title string as allowable characters remove the following part…

|&|_|-

(?!.{51,})^\d{3}(\.\d{1,2}){0,1}(\s{1,2})(([ACZEFGHILMOPQRSTaczefghilmopqrst]\d{0,2}(\.\d{1,2}){0,1})|([a-zA-Z]{1,3}\d{0,2}(\.\d{1,2}){0,1}))\s{1,2}(([a-zA-Z0-9]|\s|&|_|-){1,})\.(p|P)(d|D)(f|F)$

REGEX for naming standards starting with discipline indicators:

United States National CAD Standard - V6: Uniform Drawing System Module 1

A1A2DDD.DD-UUU title string.PDF   
where .DD is optional,  -UUU is optional

Permitted characters for “A”

A1 = 1st level:  ABCDEFGHILMOPQRSTUVWXZabcdefghilmopqrstuvwxz

A2 = 2nd level: -ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxy

A-001 title string.pdf

a-001 title string.pdf

A-001.01-R1 title_string.pdf

el001.01-X1 title string.PDF

One char for level 1 set, one dash or one char from level 2 set, three digits, optional period and two digits, optional dash and one to three characters (A-z) or digit (0-9), a title string (can include underbar and space), .PDF

^([ABCDEFGHILMOPQRSTUVWXZabcdefghilmopqrstuvwxz])([-ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxy])(\d{3})((.\d{2}){0,1})((-(\w|\d){1,3}){0,1})\s{1,2}(([a-zA-Z0-9]|\s|&|_){1,})\.(p|P)(d|D)(f|F)$

A1.00.1 sheet title.pdf

A1.00 sheet title.pdf

ID1.00 sheet title.pdf

Id1.00 any-string.pdf

V1.00 sheet & title1.pdf

One or two chars set per table, one digit, period, two digits, optional decimal and digit, space, a sheet title string, .PDF

^(([ASPMELCGV]|[aspmelcgv])|(ID|id|Id|iD)|(sc|SC|Sc|sC)|(ls|LS|Ls|sL)|(FP|fp|Fp|fP)){1}\d{1}\.\d{2}(\.\d){0,1}\s{1,2}(([a-zA-Z0-9]|\s|_|-|&){1,})\.(p|P)(d|D)(f|F)$

100 - title.pdf

A100 - lower floor plan.pdf

A100-lower floor plan.pdf

a100.05-lower floor plan.pdf

File name is limited to 40 characters in total

One or two chars (per table) and three digits, optional period two digits, dash, sheet name, .PDF OR just three digits, dash, “Title”, .PDF

 

Total file name limited to 40 chars in total…

Regex:  (?!.{41,})

(?!.{41,}) ((([ASPEMLVFHaspemlvfh]|(EN|en|eN|En))\d{3}(\.\d{1,2}){0,1}(-|\s{1,2}-|-\s{1,2}|\s{1,2}-\s{1,2})([a-zA-Z0-9]|\s|&|_){1,})|((\d{3})(-|\s{1,2}-|-\s{1,2}|\s{1,2}-\s{1,2})(t|T)(i|I)(t|T)(l|L)(e|E)))\.(p|P)(d|D)(f|F)$

0-Title.PDF

0 - Title.pdf

0- Title.PDF

A1.0-Sheet Title.PDF

C1.22 Sheet Title.Pdf

C1.2_Sheet Title.pdf

C1.2 - Sheet & Detail1.pdf

Either a zero dash “Title” (can have spaces between the dash) OR one char (A,C,E,F,L,M,P or S), one digit, a “period”, follow by digit, followed by a dash (can have spaces between) or “space” or “underline” and sheet title string, .PDF

 

^((([ACEFLMPSaceflmps])\d\.\d{1,2}(\s{1,2}|_|-|\s-\s)([a-zA-Z0-9]|\s|&|_){1,})|((0-|0\s-|0\s-\s|0-\s)(t|T)(i|I)(t|T)(l|L)(e|E)))\.(p|P)(d|D)(f|F)$

A000 any string.pdf

a003 any string.pdf

A000.05 any_string.pdf

A000.05-any_string.pdf

A000.05_any string.pdf A000.05-any string.pdf

EN000.05 - any string.pdf

EN999 any string.pdf

One or two chars per the table (i.e., A,S,P,E,M,L,V,F,H,EN), three digits, optional period one to two digits, a space, dash, space/dash/space, sheet title string, .pdf

 

^([ASPEMLVFHaspemlvfh]|EN|en|En|eN)(\d{3})((\.\d{1,2}){0,1})((\s{1,2}|_|\s{0,}-\s{0,})([a-zA-Z0-9]|\s|&|_){1,})\.(p|P)(d|D)(f|F)$

0001-Cover Sheet.pdf

002 - Code Analysis.PDF

A001 -First Floor Plan.pDF

A0001-first floor plan.PDF

GB001-Energy Verification Sheet.pdf

Either Three to four digits, dash OR one or more spaces between a dash and then a title string, OR Discipline header (from table) followed by three to four digits, dash OR one or more spaces between a dash and then a title string,.pdf

Alt:  CDDD.DD  CDDD.D  (for inserts)

0001-Cover Sheet.pdf

0002 - Code Analysis.PDF

A001.01 -First Floor Plan.pDF

A0001.5-first floor plan.PDF

GB001-Energy Verification Sheet.pdf

Add ((\.\d{1,2}){0,1})) after discipline sheet number (3 to 4 digits)

^((\d{3,4})|((([ASZEFMPLDaszefmpld]|((G|g)(B|b))|((I|i)(N|n))|((D|d)(D|d)(O|o)(E|e))|((C|c)(I|i)(V|v))|((E|e)(L|l)(V|v))){1})(\d{3,4})))(\s{0,2}-\s{0,2})(([a-zA-Z0-9]|\s|&|_|-){1,})\.(p|P)(d|D)(f|F)$

For one to two digits insert option – alternative pattern 

^((\d{3,4})|((([ASZEFMPLDaszefmpld]|((G|g)(B|b))|((I|i)(N|n))|((D|d)(D|d)(O|o)(E|e))|((C|c)(I|i)(V|v))|((E|e)(L|l)(V|v))){1})(\d{3,4}((\.\d{1,2}){0,1}))))(\s{0,2}-\s{0,2})(([a-zA-Z0-9]|\s|&|_|-){1,})\.(p|P)(d|D)(f|F)$

REGEX for naming standards with leading project name strings:

2020PW0155T1.PDF

2021PW0159S2.PDF

2021PW0160E1.PDF

2021PW0160E2.PDF

2021PW0160E99.PDF

MUST BE ALL CAPS

For digits, followed by “PW”, followed by four digits, a char (either T,W,S,E), one or two digits, .PDF

 

^\d{4}PW\d{4}([TWSE])\d{1,2}\.(p|P)(d|D)(f|F)$

project name A1.00.1 sheet title.pdf

project name A1.00 sheet title.pdf

project_name ID1.00 sheet title.pdf

project-name Id1.00 any string.pdf

project & name V1.00 sheet title.pdf

A project name string, one or two chars set per table, one digit, period, two digits, optional decimal and digit, space, a sheet title string, .PDF

^(([a-zA-Z0-9]|\s|_|-|&){1,}){0,1}(([ASPMELCGV]|[aspmelcgv])|(ID|id|Id|iD)|(sc|SC|Sc|sC)|(ls|LS|Ls|sL)|(FP|fp|Fp|fP)){1}\d{1}\.\d{2}(\.\d){0,1}\s{1,2}(([a-zA-Z0-9]|\s|&|_){1,})\.(p|P)(d|D)(f|F)$

REGEX for naming standards (complex) examples:

NOTE: this naming standard requires ALL CAPS.

^(([ACDEGLMPRSTVX]-{0,1}\d{2}(-\d{1,2}){0,1})|(A-{0,1}0|DOC-{0,1}0|C-{0,1}0|PZD-{0,1}0)|((BLD|ERD|ETR|HEP|MDC|NOA|PAP|PHD|PHO|PPD|PZD|RPF|RPW|CG|CS|CTPL|CWS|FA|FP|FS|IR|LS|MF|OD)-{0,1}\d{2}(-\d{1,2}){0,1})|((40-{0,1}[SEC])))\.(p|P)(d|D)(f|F)$

To add sheet title option – alternative pattern  example:  A-01-3 sheet_title1 & more.pdf

^(([ACDEGLMPRSTVX]-{0,1}\d{2}(-\d{1,2}){0,1})|(A-{0,1}0|DOC-{0,1}0|C-{0,1}0|PZD-{0,1}0)|((BLD|ERD|ETR|HEP|MDC|NOA|PAP|PHD|PHO|PPD|PZD|RPF|RPW|CG|CS|CTPL|CWS|FA|FP|FS|IR|LS|MF|OD)-{0,1}\d{2}(-\d{1,2}){0,1})|((40-{0,1}[SEC])))\s{1,2}(([a-zA-Z0-9]|\s|&|_|-){1,})\.(p|P)(d|D)(f|F)$

NOTE: full list of disciplines characters…

 

G,C,S,A,ID,I,QF,P,M,E,EL

 

G0.00_COVER SHT.pdf

A0.01_DEMO-FLR1.pdf

C04.01_DEMO.pdf

S2_FOUNDATION.pdf

S3_SECT & DTLS.pdf

S4_FRMG SEC DTLS.pdf

A0.02 DEMO-FLR2.pdf

I1.2A_FLR2 CLG.pdf

I1.2B_FLR2 CLG.pdf

I2.0_EXT ELEV.pdf

I4.0_WN-DR SCHED.pdf

QF-6.0_WALL BACK.pdf

P2.01_FLR1 PLBG.pdf

M5.01_SCHED DTLS.pdf

E4.01_SCHED DTLS.pdf

EL2.01_FLR1 LTG.pdf

(?!.{41,})^(([acegimpsACEGIMPS]|ID|id|iD|Id|qf-|QF-|qF-|Qf-|EL|el|El|eL)(\d{1,2})((\.\d{1,2})|(\.\d[a-zA-Z])){0,1})(\s{1,2}|_)(\w|\s|-|&|_){1,}\.(p|P)(d|D)(f|F)$

To just do the purple section, discipline “C” only  (as example)  – alternative pattern example

(?!.{41,})^(([cC])(\d{1,2})((\.\d{1,2})|(\.\d[a-zA-Z])){0,1})(\s{1,2}|_)(\w|\s|-|&|_){1,}\.(p|P)(d|D)(f|F)$