queryWithRegexFirst method

String? queryWithRegexFirst({
  1. required String pattern,
  2. int group = 1,
})

Extracts the first match using a regular expression pattern.

Returns the first matching text content, or null if no matches found.

Implementation

String? queryWithRegexFirst({
  required String pattern,
  int group = 1,
}) {
  List<String> results = queryWithRegex(pattern: pattern, group: group);
  return results.isNotEmpty ? results.first : null;
}