Hello Dev Community! π
It is officially Day 90 of my 100-day full-stack and database engineering sprint! π― Reaching the 90-day mark feels incredible. Yesterday, I worked with basic directional string filters. Today, I tackled compound textual intersections and text negation boundaries on HackerRank by mastering: Bi-Directional REGEXP Matching and Inverse Character Constraints! ππ₯
In enterprise backend applications, data filtering isn't always linear. You often need to enforce strict multi-conditional text matchingβlike verifying that a dynamic string conforms to formatting criteria at both its entry and exit boundaries.
π§ Breaking Down the Day 90 Structural Challenges
As written inside my testing scripts across "Screenshot (196).png" and "Screenshot (197).png", I replicated the schemas locally to verify how the SQL compiler handles complex regular expression matches:
1. Challenge: Weather Observation Station 8 (Bi-Directional Matching)
-
The Goal: Query the list of unique
CITYnames fromSTATIONthat both start with vowels AND end with vowels. -
The Execution: Instead of grouping slow, repetitive
ANDstatement loops, I unified the entire boundary pipeline using a single optimized regular expression containing wildcards (.*) to connect the starting caret (^) and ending dollar ($) anchors:
sql
SELECT DISTINCT CITY
FROM STATION
WHERE CITY REGEXP "^[AEIOU].*[aeiou]$";
Top comments (0)