regExpForMultipleMatches function

RegExp regExpForMultipleMatches(
  1. Iterable<String> sources,
  2. {bool multiLine = false,
  3. bool caseSensitive = true,
  4. bool unicode = false,
  5. bool dotAll = false}
)

Creates a RegExp that matches all the sources.

Implementation

RegExp regExpForMultipleMatches(Iterable<String> sources,
    {bool multiLine = false,
    bool caseSensitive = true,
    bool unicode = false,
    bool dotAll = false}) {
  final value = sources.fold<String>(
      '',
      (previousValue, element) =>
          previousValue.isEmpty ? '$element' : '$previousValue|\\$element');
  return RegExp(value,
      multiLine: multiLine,
      caseSensitive: caseSensitive,
      unicode: unicode,
      dotAll: dotAll);
}