Greedy and lazy quantifiers by msisaifu · Pull Request #199 · javascript-tutorial/bn.javascript.info
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Greedy and lazy quantifiers #199
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 9-regular-expressions/10-regexp-greedy-and-lazy/1-lazy-greedy/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
|
|
||
| The result is: `match:123 4`. | ||
| ফলাফলটি হল: `match:123 4`। | ||
|
|
||
| First the lazy `pattern:\d+?` tries to take as little digits as it can, but it has to reach the space, so it takes `match:123`. | ||
| প্রথমে লেজি মোডে এই প্যাটার্নটি `pattern:\d+?` চেষ্টা করে যত কম সম্ভব অঙ্ক নেয়ার, কিন্তু প্যাটার্নের পরবর্তী স্পেস এর জন্য এটি স্পেস পর্যন্ত মেলে, সুতরাং এটি `match:123` এর সাথে মেলে। | ||
|
|
||
| Then the second `\d+?` takes only one digit, because that's enough. | ||
| অতঃপর পরবর্তী `\d+?` শুধু একটি অঙ্ক নেই, কেননা এরপর আর কোন প্যাটার্ন নেই। |
4 changes: 2 additions & 2 deletions 9-regular-expressions/10-regexp-greedy-and-lazy/1-lazy-greedy/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
|
|
||
| The solution is `pattern:<[^<>]+>`. | ||
| সমাধানটি হল `pattern:<[^<>]+>`। | ||
|
|
||
| ```js run | ||
| let regexp = /<[^<>]+>/g; | ||
| Expand Down | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,15 @@ | ||
| # Find HTML tags | ||
| # এইচটিএমএল ট্যাগের অনুসন্ধান | ||
|
|
||
| Create a regular expression to find all (opening and closing) HTML tags with their attributes. | ||
| একটি প্যাটার্ন লিখুন যেন সকল এইচটিএমএল ট্যাগগুলো(অ্যাট্রিবিউটসহ) খুঁজে পায়. | ||
|
|
||
| An example of use: | ||
| উদাহরণস্বরূপ: | ||
|
|
||
| ```js run | ||
| let regexp = /your regexp/g; | ||
| let regexp = /আপনার প্যাটার্ন/g; | ||
|
|
||
| let str = '<> <a href="/"> <input type="radio" checked> <b>'; | ||
|
|
||
| alert( str.match(regexp) ); // '<a href="/">', '<input type="radio" checked>', '<b>' | ||
| ``` | ||
|
|
||
| Here we assume that tag attributes may not contain `<` and `>` (inside squotes too), that simplifies things a bit. | ||
| এখানে কিছুটা সহজের জন্য আমরা ধরে নিয়েছি অ্যাট্রিবিউটের মাঝে এই দুটি বন্ধনী `<` এবং `>` থাকবে না। |