regexpattern 2.6.0 regexpattern: ^2.6.0 copied to clipboard
Flutter list of regex pattern with purpose for string validation
import 'package:flutter/material.dart';
import 'package:regexpattern/regexpattern.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Regex Pattern Example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Regex Pattern Example Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
String text = 'https://google.com';
bool isMatch = text.isUrl();
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'isUrl - $text: $isMatch',
),
],
),
),
);
}
}