Regular Expressions 101

Save & Share

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression

/
/
m

Test String

Code Generator

Generated Code

#include <StringConstants.au3> ; to declare the Constants of StringRegExp #include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate Local $sRegex = "(?m)^ *analyticsConfig\.analyticsClass = WLAnalyticsWrapper\.self" Local $sString = "@objc (WLAppDelegate)" & @CRLF & _ "open class WLAppDelegate: LUUIBaseAppDelegate {" & @CRLF & _ "" & @CRLF & _ " fileprivate var overrideTabBarControllerDelegate: LUUITabBarControllerDelegate?" & @CRLF & _ " open override var tabBarControllerDelegate: UITabBarControllerDelegate? {" & @CRLF & _ " if overrideTabBarControllerDelegate == nil {" & @CRLF & _ " overrideTabBarControllerDelegate = WLTabBarControllerDelegate()" & @CRLF & _ " }" & @CRLF & _ " return overrideTabBarControllerDelegate" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " @objc open override func applyAppearance() {" & @CRLF & _ " super.applyAppearance()" & @CRLF & _ " WLAppearance.apply()" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " // swiftlint:disable:next function_body_length" & @CRLF & _ " @objc open override func configureApplicationKeys() {" & @CRLF & _ " let appConfig: LUUIApplicationConfiguration = LUUIApplicationConfiguration.shared()" & @CRLF & _ "" & @CRLF & _ " appConfig.crashlyticsAPIKey = WLCrashlyticsAPIKey" & @CRLF & _ " appConfig.googleAnalyticsTrackingID = WLGoogleAnalyticsTrackingID" & @CRLF & _ " appConfig.inviteFriendsShowsQRCode = true" & @CRLF & _ " appConfig.referAFriendCampaignID = NSNumber(value: WLReferAFriendCampaignID)" & @CRLF & _ " appConfig.usesSideNavigation = false" & @CRLF & _ " appConfig.enablePaymentPreferenceSelection = true" & @CRLF & _ " appConfig.sendGiftCardFromSettings = true" & @CRLF & _ " appConfig.claimBankingEnabled = true" & @CRLF & _ " appConfig.showEnableLocationAlert = true" & @CRLF & _ " appConfig.enableFacebookLogin = true" & @CRLF & _ " appConfig.myRewardsEnabled = true" & @CRLF & _ " appConfig.showOptionalInfoDuringRegistration = true" & @CRLF & _ " appConfig.analyticsConfiguration = analyticsConfiguration()" & @CRLF & _ " appConfig.cardReaderConfiguration = cardReaderConfiguration()" & @CRLF & _ " appConfig.appLocationsScreen = .mapLocations" & @CRLF & _ " appConfig.allowsOrderAhead = true" & @CRLF & _ " appConfig.enableOrderAheadLandingScreen = true" & @CRLF & _ " appConfig.allowsOrderAheadDelivery = false" & @CRLF & _ " appConfig.orderAheadMenuLayoutStyle = .list" & @CRLF & _ " appConfig.modularRewardsEnabled = true" & @CRLF & _ " appConfig.enableOrderAheadTipCell = false" & @CRLF & _ "" & @CRLF & _ " appConfig.levelupAPIKey = WLLevelUpAPIKey" & @CRLF & _ " appConfig.environmentConfigProd.levelupAppID = WLLevelUpAPIKey as NSString" & @CRLF & _ " appConfig.environmentConfigStaging.levelupAPIKey = WLLevelUpAPIKeyStaging as NSString" & @CRLF & _ "" & @CRLF & _ " appConfig.levelupAppID = WLLevelUpAppID" & @CRLF & _ " appConfig.environmentConfigProd.levelupAppID = WLLevelUpAppID as NSString" & @CRLF & _ " appConfig.environmentConfigStaging.levelupAppID = WLLevelUpAppIDStaging as NSString" & @CRLF & _ "" & @CRLF & _ " if WLLegacyLoyaltyCampaignID > 0 {" & @CRLF & _ " appConfig.loyaltyMigrationCampaignID = NSNumber(value: WLLegacyLoyaltyCampaignID)" & @CRLF & _ " appConfig.environmentConfigProd.loyaltyMigrationCampaignID = appConfig.loyaltyMigrationCampaignID!" & @CRLF & _ " appConfig.environmentConfigStaging.loyaltyMigrationCampaignID = NSNumber(value: WLLegacyLoyaltyCampaignIDStaging)" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " if WLReferAFriendCampaignID > 0 {" & @CRLF & _ " appConfig.referAFriendCampaignID = NSNumber(value: WLReferAFriendCampaignID)" & @CRLF & _ " appConfig.environmentConfigProd.referAFriendCampaignID = appConfig.referAFriendCampaignID!" & @CRLF & _ " appConfig.environmentConfigStaging.referAFriendCampaignID = NSNumber(value: WLReferAFriendCampaignIDStaging)" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " if let rewardsLoyaltyCampaignID: NSNumber = applicationConfig().rewardsLoyaltyCampaignID {" & @CRLF & _ " appConfig.rewardsLoyaltyCampaignID = rewardsLoyaltyCampaignID" & @CRLF & _ " appConfig.rewardsLoyaltyCampaignType = .spendBased" & @CRLF & _ " } else if WLRewardsLoyaltyCampaignID > 0 {" & @CRLF & _ " appConfig.rewardsLoyaltyCampaignID = NSNumber(value: WLRewardsLoyaltyCampaignID)" & @CRLF & _ " appConfig.environmentConfigProd.rewardsLoyaltyCampaignID = appConfig.rewardsLoyaltyCampaignID!" & @CRLF & _ " appConfig.environmentConfigStaging.rewardsLoyaltyCampaignID = NSNumber(value: WLRewardsLoyaltyCampaignIDStaging)" & @CRLF & _ " appConfig.rewardsLoyaltyCampaignType = .spendBased" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " if WLRewardsStatusCampaignID > 0 {" & @CRLF & _ " appConfig.rewardsStatusCampaignID = NSNumber(value: WLRewardsStatusCampaignID)" & @CRLF & _ " appConfig.environmentConfigProd.rewardsStatusCampaignID = appConfig.rewardsStatusCampaignID!" & @CRLF & _ " appConfig.environmentConfigStaging.rewardsStatusCampaignID = NSNumber(value: WLRewardsStatusCampaignIDStaging)" & @CRLF & _ " appConfig.rewardsStatusCampaignType = .spendBased" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " appConfig.analyticsConfiguration = analyticsConfiguration()" & @CRLF & _ " appConfig.cardReaderConfiguration = cardReaderConfiguration()" & @CRLF & _ " appConfig.crashReportingConfiguration = crashReportingConfiguration()" & @CRLF & _ " appConfig.viewControllerConfiguration = viewControllerConfiguration()" & @CRLF & _ " appConfig.viewConfiguration = viewConfiguration()" & @CRLF & _ " appConfig.cellConfiguration = cellConfiguration()" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " @objc open func analyticsConfiguration() -> LUUIAnalyticsConfiguration {" & @CRLF & _ " let analyticsConfig: LUUIAnalyticsConfiguration = LUUIAnalyticsConfiguration()" & @CRLF & _ " analyticsConfig.analyticsClass = WLAnalyticsWrapper.self" & @CRLF & _ " return analyticsConfig" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " @objc open func cardReaderConfiguration() -> LUUICardReaderConfiguration {" & @CRLF & _ " let cardReaderConfig: LUUICardReaderConfiguration = LUUICardReaderConfiguration()" & @CRLF & _ " cardReaderConfig.cardReaderViewControllerClass = WLCardReaderViewController.self" & @CRLF & _ " return cardReaderConfig" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " @objc open func crashReportingConfiguration() -> LUUICrashReportingConfiguration {" & @CRLF & _ " let crashReportingConfig: LUUICrashReportingConfiguration = LUUICrashReportingConfiguration()" & @CRLF & _ " crashReportingConfig.crashReportingWrapperClass = WLCrashlyticsWrapper.self" & @CRLF & _ " return crashReportingConfig" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " @objc open override func tabBarViewControllers() -> [Any]? {" & @CRLF & _ " return UITabBarController.loggedInTabBarController()" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " @objc open func viewConfiguration() -> LUUIViewConfiguration {" & @CRLF & _ " let config = LUUIViewConfiguration()" & @CRLF & _ "" & @CRLF & _ " config.imageRewardProgressionViewClass = WLImageRewardProgressionView.self" & @CRLF & _ "" & @CRLF & _ " return config" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " @objc open func viewControllerConfiguration() -> LUUIViewControllerConfiguration {" & @CRLF & _ " let config = LUUIViewControllerConfiguration()" & @CRLF & _ "" & @CRLF & _ " config.confirmGiftCardOrderViewControllerClass = WLConfirmGiftCardOrderViewController.self" & @CRLF & _ " config.forgotPasswordViewControllerClass = WLForgotPasswordViewController.self" & @CRLF & _ " config.getStartedViewControllerClass = WLGetStartedViewController.self" & @CRLF & _ " config.interstitialViewControllerClass = WLInterstitialViewController.self" & @CRLF & _ " config.inviteFriendsViewControllerClass = WLInviteFriendsViewController.self" & @CRLF & _ " config.logInViewControllerClass = WLLogInViewController.self" & @CRLF & _ " config.mapLocationsLocationDetailViewControllerClass = WLMapLocationsLocationDetailViewController.self" & @CRLF & _ " config.mapLocationsSearchViewControllerClass = WLMapLocationsSearchViewController.self" & @CRLF & _ " config.mapLocationsViewControllerClass = WLMapLocationsViewController.self" & @CRLF & _ " config.orderAheadLandingViewControllerClass = WLOrderAheadLandingViewController.self" & @CRLF & _ " config.orderGiftCardViewControllerClass = WLOrderGiftCardViewController.self" & @CRLF & _ " config.paymentMethodDetailViewControllerClass = WLPaymentMethodDetailViewController.self" & @CRLF & _ " config.payViewControllerClass = WLPayViewController.self" & @CRLF & _ " config.scanSuccessViewControllerClass = WLScanSuccessViewController.self" & @CRLF & _ " config.selectPaymentPreferenceViewControllerClass = WLSelectPaymentPreferenceViewController.self" & @CRLF & _ " config.settingsViewControllerClass = WLSettingsViewController.self" & @CRLF & _ " config.signUpViewControllerClass = WLSignUpViewController.self" & @CRLF & _ " config.signUpOrLogInViewControllerClass = WLSignUpOrLogInViewController.self" & @CRLF & _ " config.transactionDetailViewControllerClass = WLTransactionDetailViewController.self" & @CRLF & _ " config.transactionHistoryViewControllerClass = WLTransactionHistoryViewController.self" & @CRLF & _ " config.rewardsStatusLevelsViewControllerClass = WLRewardsStatusLevelsViewController.self" & @CRLF & _ " config.permissionPrimerViewControllerClass = WLPermissionPrimerViewController.self" & @CRLF & _ " config.selectPaymentMethodViewControllerClass = WLSelectPaymentMethodViewController.self" & @CRLF & _ " config.availableRewardsDrawerViewControllerClass = WLAvailableRewardsDrawerViewController.self" & @CRLF & _ " config.modularRewardsViewControllerClass = WLModularRewardsViewController.self" & @CRLF & _ "" & @CRLF & _ " return config" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " @objc open func cellConfiguration() -> LUUICellConfiguration {" & @CRLF & _ " let config = LUUICellConfiguration()" & @CRLF & _ "" & @CRLF & _ " config.captionedImageHeaderViewCellClass = WLCaptionedImageHeaderViewCell.self" & @CRLF & _ " config.locationCellClass = WLLocationCell.self" & @CRLF & _ " config.mapLocationsButtonsCellClass = WLMapLocationsButtonsCell.self" & @CRLF & _ " config.mapLocationsLocationCellClass = WLMapLocationsLocationCell.self" & @CRLF & _ " config.transactionEarnedCreditCellClass = WLTransactionEarnedCreditCell.self" & @CRLF & _ " config.transactionHistoryCellClass = WLTransactionHistoryCell.self" & @CRLF & _ " config.statusLevelGoalCellClass = WLStatusLevelGoalCell.self" & @CRLF & _ " config.availableRewardIconTableViewCellClass = WLAvailableRewardIconTableViewCell.self" & @CRLF & _ " config.orderAheadSpecialInstructionsCellClass = WLOrderAheadSpecialInstructionsCell.self" & @CRLF & _ " config.orderAheadCategoryMenuListTableViewCellClass = WLOrderAheadCategoryMenuListTableViewCell.self" & @CRLF & _ "" & @CRLF & _ " return config" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " @objc open override func settingsSectionsData() -> LUUIStaticTableViewData {" & @CRLF & _ " let data = LUUIStaticTableViewSectionsData()" & @CRLF & _ "" & @CRLF & _ " data.add(WLStaticTableViewSectionFactory.customSocialSection())" & @CRLF & _ " data.add(WLStaticTableViewSectionFactory.customAccountSection())" & @CRLF & _ " data.add(WLStaticTableViewSectionFactory.customHelpSection())" & @CRLF & _ "" & @CRLF & _ " return data" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ "}" & @CRLF & _ "" Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH) ; Present the entire match result _ArrayDisplay($aArray, "Result")

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm