-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrapp.py
29 lines (21 loc) · 1000 Bytes
/
rapp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import re
from flask import Flask, request, render_template, url_for, redirect
app = Flask(__name__)
@app.route('/')
def index():
#return "<h1> hello wwelcome to string regex checker </h1>"
#return render_template('home page.html')
return render_template('regform.html')
@app.route('/result')
def result():
return render_template('result.html')
@app.route('/regex',methods =['POST', 'GET'])
def regex():
if request.method=="POST":
target_string = request.form['target_string'] #str(input("enter the string you want to check reg ex for : "))
regex_ptrn = request.form['regex_ptrn'] #input(" enter the regex patttern that you want to check fo r your string : ")
matched_string = re.findall(regex_ptrn, target_string)
return render_template('regform.html', matched_string=matched_string)
#('your matched string is ',matched_string)
if __name__=='__main__':
app.run(debug=True)