Welcome to Geeklog, Anonymous Monday, December 23 2024 @ 07:36 am EST

Geeklog Forums

The perl in Spax-X's "Edit Personal Blacklist"


Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
If I write more than one word as a single entry, will it only delete that if it appears as the exact phrase or does it treat the space as and?

For example, if a single entry is "foo bar", will it only delete "this sentence contains foo bar." and not "this sentence contains foo and it also contains bar."?

Or must I use some special perl commands like (foo|bar) for both foo and bar, and (foo bar) for an exact phrase?

Thanks!
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
As it says right there in the plugin: "Entries can use full Perl Regular Expressions.", i.e. whatever you enter is treated as a regular expression.

"foo bar" would only match this exact phrase (with the space).

bye, Dirk
 Quote

Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
Exact phrase then. So what if I want to treat it like and (as in only censor this if both words are used)?
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
You would need to do two rules: /\bfoo\b.*\bbar\b/i and /\bbar\b.*\bfoo\b/i That says find the word "foo" then skip over stuff until you find the word "bar" and don't worry about case sensitivity. The \b says that there is a word boundary. So "/\bfoo\b/" will match foo but not food. The . says match any one character and * says match the prior character 0 or more times. That allows you to skip over a bunch of stuff until the next match.
 Quote

All times are EST. The time is now 07:36 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content