I'm currently in Regex101 testing /for\s*\(([\w_])\s=\s(-?\d+(\.\d+)?);\s([\w_])\s(<…
- User
I'm currently in Regex101 testing
/for\s*\(([\w_]*)\s*=\s*(-?\d+(\.\d+)?);\s*([\w_]*)\s*(<|>)\s*(-?\d+(\.\d+)?);\s*([\w_]*)\s*(\+=|-=|\*=|\/=)\s*(-?\d+(\.\d+)?)\):([\S\s]*?)\Z/gm. Generate me 4 test strings - Assistant
Certainly! Here are four test strings that match your provided regular expression:
1. Simple Increment Loop
for (i = 0; i < 10; i += 1): console.log(i);
2. Decrement Loop with Floating Points
for (count = -5; count > 0; count -= 0.5): doSomething();
3. Multiplication in Loop Control
for (index = 100; index > -50; index *= 10): execute();
4. Using Underscores and Division Operator
for (loop_counter = 3.14; loop_counter < 10.0; loop_counter /= 2): performAction();