Placeholder Image

字幕列表 影片播放

由 AI 自動生成
  • (gentle music)

    (溫柔的音樂)

  • - [Brad] As you go to create your filters, it's very common,

    - [Brad]當你去創建你的過濾器時,這是很常見的。

  • that you'll need to use regular expressions

    那你就需要使用正則表達式

  • to really get them to do what you want them to do.

    以真正讓他們做你想讓他們做的事。

  • And regular expressions are most commonly

    而正則表達式最常見的是

  • referred to as regex.

    被稱為regex。

  • And this is a language that is used to describe

    而這是一種用來描述的語言

  • a search pattern.

    一個搜索模式。

  • It allows you to use essentially very powerful wildcards.

    它允許你使用本質上非常強大的通配符。

  • Let's say for example,

    比方說

  • that our office had the following IP address range.

    我們的辦公室有以下IP地址範圍。

  • And we want to exclude this range from ever capturing

    而我們想排除這個範圍,使其永遠不被捕捉到

  • data in Google Analytics.

    谷歌分析中的數據。

  • We would write regex,

    我們會寫regex。

  • which would look like this.

    這將看起來像這樣。

  • And here's how this breaks down.

    這裡是如何分解的。

  • When we see the slash,

    當我們看到斜線的時候。

  • this means that the character that comes after that slash,

    這意味著該斜線之後的字元。

  • needs to be interpreted literally.

    需要按字面意思來解釋。

  • You see, the period,

    你看,這個時期。

  • is actually a regular expression for matching

    實際上是一個正則表達式,用於匹配

  • any single character.

    任何單一字元。

  • So if we simply left the dots in the IP address,

    是以,如果我們簡單地在IP地址中留下點。

  • then the regex would use that to match any other character.

    那麼這個重構函數就會用它來匹配任何其他的字元。

  • So we have to use that proceeding slash.

    是以,我們必須使用那條進行中的斜線。

  • Now at the very end,

    現在到了最後。

  • you'll see the d, which is shorthand for any number

    你會看到D,它是任何數字的縮寫

  • zero to nine, the list of numbers from zero to nine,

    零到九,從零到九的數字列表。

  • and then the asterisk means zero or more of any character.

    然後是星號,表示零或更多的任何字元。

  • And this will essentially allow us to capture

    而這基本上將使我們能夠捕捉到

  • that entire range of IPs in one simple format.

    在一個簡單的格式中,該整個IP範圍。

  • Now regex can get incredibly complicated

    現在,regex可以變得非常複雜

  • and this is by no means meant to be a comprehensive

    這決不是說這是一個全面的

  • overview, there are plenty of resources right here

    概述,這裡有大量的資源

  • and around the web to help you get familiar.

    和網絡周圍,以幫助你熟悉。

  • But I do want to show you the ones that you'll encounter

    但我確實想向你展示你會遇到的那些情況

  • most often and the ones that are really relatively

    最常見的是那些真正比較

  • easy to use.

    易於使用。

  • The first is the pipe symbol.

    第一個是管道符號。

  • I use this one very, very often.

    我非常、非常經常地使用這個。

  • And this is used to create an OR match.

    而這是用來創建一個OR匹配。

  • Let's say I'm setting up a filter and I want to include

    比方說,我正在設置一個過濾器,我想包括

  • my blog, store and article directories.

    我的博客、商店和文章目錄。

  • I would simply put blog pipe store pipe article,

    我會簡單地把博客管店管文章。

  • and now it's going to be blog OR store OR article.

    而現在,它將成為博客或商店或文章。

  • And this is important because

    而這一點很重要,因為

  • sometimes when you create filters,

    有時,當你創建過濾器時。

  • you'll set up a filter for blog,

    你要為博客設置一個過濾器。

  • then you'll add a new filter for store.

    那麼你將為商店添加一個新的過濾器。

  • But because filters fire an OR,

    但因為過濾器發射了一個OR。

  • they don't naturally create an OR mechanism.

    他們不自然地創造一個OR機制。

  • So if I filtered out blog

    是以,如果我過濾掉了博客

  • and then I fired another filter for store,

    然後我又為商店開了一個過濾器。

  • store's not going to exist

    商店不存在了

  • because I've already filtered for blog.

    因為我已經為博客過濾了。

  • So at the very high level,

    是以,在非常高的水準上。

  • I would create this filter with the OR statement.

    我將用OR語句創建這個過濾器。

  • Next you can use a caret to indicate that something starts

    接下來,你可以用一個圓點來表示某些東西開始了

  • with this word.

    用這個詞。

  • Let's say I had numerous contact pages.

    比方說,我有許多聯繫頁面。

  • I had contact dash sales, contact dash customers,

    我曾接觸過沖繩的銷售,接觸過沖繩的客戶。

  • contact dash clients and so on.

    聯繫衝刺客戶等等。

  • If I use the caret symbol contact,

    如果我用圓點符號聯繫。

  • it's going to find anything that starts with that term.

    它將會找到任何以這個詞開頭的東西。

  • Contrary to that, I can use a dollar symbol

    與此相反,我可以使用一個美元符號

  • at the end of a term to indicate that I want everything

    在一個學期結束時,表示我希望一切

  • that ends in this word.

    以這個詞結尾的。

  • So let's say I had a store dash order,

    是以,假設我有一個商店的衝刺訂單。

  • contact dash order and so on,

    聯繫破折號訂單等等。

  • I would put the dollar sign

    我想把美元符號

  • and that would find anything that ends with it.

    而這將找到任何以它為結尾的東西。

  • And finally,

    而最後。

  • when you include either letters or numbers

    當你包括字母或數字時

  • in between a bracket with a dash symbol,

    在一個帶破折號的括號中。

  • you're going to create a list.

    你要創建一個列表。

  • If I had page dash AA,

    如果我有頁衝的AA。

  • page dash AB,

    page dash AB,

  • and so on,

    等等。

  • I could match that with the following regular expression.

    我可以用下面的正則表達式來匹配它。

  • Now this is very touch and go with regular expressions,

    現在,這對正則表達式來說是非常有意義的。

  • but these are the ones that you encounter most commonly.

    但這些是你最常遇到的。

  • (gentle music)

    (溫柔的音樂)

(gentle music)

(溫柔的音樂)

字幕與單字
由 AI 自動生成

單字即點即查 點擊單字可以查詢單字解釋