Home > OS >  Regex to search asset tags on AutoCAD drawings
Regex to search asset tags on AutoCAD drawings

Time:10-29

I have refrained from posting a question here because I wanted to do my bit to find myself a solution to this issue. But unfortunately, after entire nights of searching and reading different Regex articles and docs I couldn't find an answer.

I have written a script that spills out the comment from PDF that have been converted from AutoCAD. Problem is, which drawing has a different pattern of the asset tag information.

Our convention is 99XX9999 (two-numbers, two-letters, four-numbers).

Some drawings preserve that pattern, others don't. We can find things like 99XX(space)9999 OR 99(space)XX(space)9999, etc.

That part of the problem I resolved it, but there's another variant that I can't wrap my head around as per below:

'''

{'/Border': [0, 0, 0], '/Contents': '0811', '/F': 64, '/NM': 'b4499c47-d2d2-4c03-b13c-ec3b7b332ec3', '/P': IndirectObject(52, 0), '/Rect': [714, 304, 698, 314], '/Subtype': '/Square', '/T': 'AutoCAD SHX Text'}-------------------------------------------------------------------------------- {'/Border': [0, 0, 0], '/Contents': '29', '/F': 64, '/NM': 'b518c663-42eb-4861-a717-a00118d61fd2', '/P': IndirectObject(52, 0), '/Rect': [206, 369, 195, 378], '/Subtype': '/Square', '/T': 'AutoCAD SHX Text'}-------------------------------------------------------------------------------- {'/Border': [0, 0, 0], '/Contents': 'HV', '/F': 64, '/NM': '1db0a6b1-6aee-4a2d-bacf-2a996680cdcb', '/P': IndirectObject(52, 0), '/Rect': [212, 369, 201, 378], '/Subtype': '/Square', '/T': 'AutoCAD SHX Text'}-------------------------------------------------------------------------------- {'/Border': [0, 0, 0], '/Contents': '0832', '/F': 64, '/NM': '0250033f-5bc0-4d46-879a-a1ae0147352d', '/P': IndirectObject(52, 0), '/Rect': [212, 365, 195, 374], '/Subtype': '/Square', '/T': 'AutoCAD SHX Text'}-------------------------------------------------------------------------------- {'/Border': [0, 0, 0], '/Contents': '29', '/F': 64, '/NM': '7b372206-1b18-4c9f-813d-4d73ca52be40', '/P': IndirectObject(52, 0), '/Rect': [140, 392, 129, 401], '/Subtype': '/Square', '/T': 'AutoCAD SHX Text'}-------------------------------------------------------------------------------- {'/Border': [0, 0, 0], '/Contents': 'HV', '/F': 64, '/NM': 'bdc97ccd-ee7c-406a-a06c-1649a5f5f712', '/P': IndirectObject(52, 0), '/Rect': [146, 392, 135, 401], '/Subtype': '/Square', '/T': 'AutoCAD SHX Text'}-------------------------------------------------------------------------------- {'/Border': [0, 0, 0], '/Contents': '0824', '/F': 64, '/NM': '9f434537-57a3-4c40-bb8b-a0df6ea087aa', '/P': IndirectObject(52, 0), '/Rect': [146, 388, 129, 397], '/Subtype': '/Square', '/T': 'AutoCAD SHX Text'}-------------------------------------------------------------------------------- {'/Border': [0, 0, 0], '/Contents': '%

  • Related