Regular Expressions 101

Save & Share

  • Regex Version: ver. 1
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

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

/
/
gm

Test String

Code Generator

Generated Code

$re = '/(.*)/m'; $str = '「近幾個月來,XXX Holdings的股票一直處於壓力之下,可能更多的是與市場上其他成長型公司一起被不分青紅皂白地拋售(其中許多是獲利前的公司,而其拋售的說法則是基於長期的營收預估),儘管我們認為該公司的基本面非常穩固。 12月,加州公共事業委員會提出的新法規將使住宅式屋頂太陽能電池板發電的成本提高,此進一步加劇Generac的下跌。 Generac的產品通常與住宅太陽能電力系統結合使用,並經常會與替代能源並行。 我們不知道這種輪換會持續多久,但也不認為價格壓力是由基本面決定,所以我們傾向於維持Generac的持股。鑒於Generac的財務狀況穩定、良好的執行力和持續的獲利成長(自2010年以來的年複合成長率為+12到13%),該股價理應擁有溢價空間。從目前的市場輪動以及對該公司長期發展來看,2023年13.75億美元的EBITDA估計值理應達18.5倍,從目前的股價水準來看尚有40%的潛在上漲空間。 投資論點的關鍵因素總結如下。 - 有吸引力的長期增長前景。家庭備用發電機的巨大滲透機會(目前覆蓋率只有約5%)。除了家庭備用發電機,Generac的其他事業的發展似乎尚未獲得市場的重視(即存儲/管理,5G,電網服務等)。 - 競爭優勢。Generac已經建立了一個高度信任和可信的品牌信譽,廣泛的銷售通路,產品的領先地位,以及創造市場的成功記錄。 - 處於獨特的地位,可以從日益嚴重的氣候變遷中獲益,不僅透過能源轉型增加需求,且擁有政府資金挹注。 - 訂單積壓。盡管GNRC繼續提高增量以減少訂單積壓的壓力,但其發電機的交貨時間仍然超過30週(一些經銷商聲稱更高)。博鰲亞洲論壇認為,訂單積壓的銷售量超過10億美元,此數字為2013年桑迪颶風後訂單積壓規模的8倍。與2013年不同的是,GNRC在非旺季時見到訂單積壓的高峰,該公司在風暴季節開始之前就有大量的訂單積壓。這對價格和長期生產都是正向的訊息。 - 強大的資產負債表和現金流的產生使得公司在資本分配決策方面採取了嚴謹和平衡的方法。管理層看好四個關鍵領域機會:發電、儲能、能源監測和能源管理。公司的凈槓桿率為0.6倍,相對於2-4倍的目標,公司有很穩健的財務能力。 其他需要考慮的財務亮點。 - 本年度銷售額為34億美元,EBITDA為7.98億美元,約為23.25%。 - 本年度的財務狀況為4.52億美元(約86%的轉換率)。 - 本季度ROE35.1%,CFROI24.2%。 - 凈杠桿0.6倍EBITDA,利息覆蓋率15.4倍」 投資建議:「持股續抱」 '; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); // Print the entire match result var_dump($matches);

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 PHP, please visit: http://php.net/manual/en/ref.pcre.php