Test, validate and match regular expressions
This regex parses a custom syntax used to traverse and extract specific attributes or properties from DOM elements. It captures relative DOM paths (like `self`, `ancestor`, or `prevSibling` with optional CSS-like IDs and classes) combined with bracketed properties such as `id`, `ref`, or `data-*` attributes. It is particularly useful for template engines, web scraping scripts, or custom UI frameworks that need to map specific data attributes from relative document locations.