English 中文(简体)
Youtube 安全搜索
原标题:Youtube Safe Search

我不确定这个问题是否应该在这里提出。

我该如何改变Youtube喜好饼干 才能让安全模式永远保持下去?

PREF=f1=50000000&fms2=30000&fms1=30000&fv=10.3.183

这是前菜饼干和 fms2 change to 1000 的更改, 如果安全搜索被关闭。 如果 fms2=1000 出现在 cookie 中, 我用regex 替换了文本。 但是这似乎行不通。 我如何更改 cookie, 以便关闭安全模式, 因为 cookie 替换而将它关闭?

最佳回答

首先: 我真的不确定我是否正确理解您的问题。 对于从 fms2=1000 替换为 fms2=30000 的静态字符串, 您不必使用 Regex 。 “ 正常” 字符串替换也会这样做。 但我猜还有更多。 您使用哪种语言?

第二,“关闭安全模式会因为饼干的替换而恢复安全模式”是什么意思?你想要换掉逻辑吗?“关闭”实际上是“打开”还是“打开”呢?

第三:你的数据中是否有像 URL 编码这样的额外修改, 你可能不知道?

UPDATE: My guess for the regex is (PCRE syntax - I am not so familiar with C++)

/^(?=PREF=)(.*?(?:PREF=|&)fms2=).*?($|&.*)/

替换为

$130000$2

这符合

PREF=f1=50000000&fms2=10000&fms1=30000&fv=10.3.183
PREF=f1=50000000&fms2=&fms1=30000&fv=10.3.183
PREF=f1=50000000&fms1=30000&fv=10.3.183&fms2=123
PREF=fms2=123&f1=50000000&fms1=30000&fv=10.3.183

但听起来这不仅仅是个正负问题,不是吗?请告诉我,如果你面临问题或需要解释模式,请告诉我。

问题回答

暂无回答




相关问题
Uncommon regular expressions [closed]

Recently I discovered two amazing regular expression features: ?: and ?!. I was curious of other neat regex features. So maybe you would like to share some tricky regular expressions.

regex to trap img tag, both versions

I need to remove image tags from text, so both versions of the tag: <img src="" ... ></img> <img src="" ... />

C++, Boost regex, replace value function of matched value?

Specifically, I have an array of strings called val, and want to replace all instances of "%{n}%" in the input with val[n]. More generally, I want the replace value to be a function of the match ...

PowerShell -match operator and multiple groups

I have the following log entry that I am processing in PowerShell I m trying to extract all the activity names and durations using the -match operator but I am only getting one match group back. I m ...

Is it possible to negate a regular expression search?

I m building a lexical analysis engine in c#. For the most part it is done and works quite well. One of the features of my lexer is that it allows any user to input their own regular expressions. This ...

regex for four-digit numbers (or "default")

I need a regex for four-digit numbers separated by comma ("default" can also be a value). Examples: 6755 3452,8767,9865,8766,3454 7678,9876 1234,9867,6876,9865 default Note: "default" ...

热门标签