Commonly Used Regular Expression Patterns

<h2>1. Number Validation Patterns</h2> <pre> 1. Any number: ^\d*$ 2. Exactly n digits: ^\d{n}$ (\d is equivalent to [0-9]) 3. At least n digits: ^\d{n,}$ 4. m to n digits: ^\d{m,n}$ 5. Zero or a number without leading zeros: ^(0|[1-9]\d*)$ 6. Non-zero with up to two decimal places: ^([1-9]\d*)+(\.\d{1,2})?$ 7. Positive or nega ...

Posted on Tue, 07 Jul 2026 16:20:56 +0000 by mamoman

L-Shaped String Transformation

Given a string s and a number of rows numRows, arrange the string in an L-shaped pattern from top to bottom, left to right. Then, read the characters row by row from left to right to produce a new string. Implement this transformation with the function signature: transform(s: string, numRows: number) => string For example, with input string ...

Posted on Thu, 14 May 2026 21:23:58 +0000 by LDusan