Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bb17e3e

Browse files
Create regex_new_line_counter.py
1 parent 4f8170d commit bb17e3e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎regex_new_line_counter.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import re
2+
3+
long_str = '''Just some words
4+
and some more\r
5+
and more
6+
'''
7+
8+
print("Matches:", len(re.findall(r"[\w\s]+[\r]?\n", long_str)))
9+
matches = re.findall("[\w\s]+[\r]?\n", long_str)
10+
11+
for i in matches:
12+
print(i)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /