We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1829b14 commit 1083247Copy full SHA for 1083247
README.md
@@ -92,3 +92,17 @@ $ Matches the end of the line
92
( Indicates where string extraction is to start
93
) Indicates where string extraction is to end
94
```
95
+### Usage in Python:
96
+```python
97
+#re.search()- check if a string matches a regular expression
98
+#re.findall()- extract portions of string that matches our regular expressions
99
+
100
+import re
101
+hand=open('text.txt')
102
+for line in hand:
103
+ line=line.rstrip()
104
+ if re.search('^From:',line)
105
+ print(line)
106
107
+EX--> ^X.*: --> starts with X, followed by 1 or more (due to +) non-blank characters (due to \S) and then ':'
108
+```
0 commit comments