如何提高搜索字符数限制?现在在示例中是3276个字符但在3275中它的工作正常
ini_set("pcre.backtrack_limit", "23001337");
ini_set("pcre.recursion_limit", "23001337");
$str = "<div>";
for ($x=1;$x<=327;$x++){
$str .= "1234567890";
}
$str .="123456";
$str .= "</div>";
$w1 = "/<div>((.*?|\n)*)<\/div>/";
preg_match_all($w1, $str, $matches);
print_r($matches);
答案 0 :(得分:1)
尝试禁用pcre.jit(不要使用PCRE的即时编译):
import Foundation
// Response "Data" key array elements
struct Level: Codable {
let time: Double
let close: Double
let high: Double
let low: Double
let open: Double
let volumefrom: Double
let volumeto: Double
}
// The whole response (with some keys missing)
struct Response: Codable {
let response: String
let type: Int
let aggregated: Bool
let data: [Level] // Translates the JSON array
// custom key names
private enum CodingKeys : String, CodingKey {
case data = "Data"
case response = "Response"
case type = "Type"
case aggregated = "Aggregated"
}
}
// The actual JSON String (shortened to two array members)
let json = """
{"Response":"Success",
"Type":100,
"Aggregated":true,
"Data":[
{"time":1514469240,"close":14090.41,"high":14119.99,"low":14077.7,"open":14093.54,"volumefrom":189.71,"volumeto":2696906.84},
{"time":1514469420,"close":14127.84,"high":14131.19,"low":14081.38,"open":14090.41,"volumefrom":197.76,"volumeto":2805972.44}],
"TimeTo":1514480160,
"TimeFrom":1514469240,
"FirstValueInArray":true,
"ConversionType":{
"type":"direct",
"conversionSymbol":""}}
"""
// Make the String into a Data and decode it
if let jsonData = json.data(using: .utf8),
let decoded = try? JSONDecoder().decode(Response.self, from: jsonData) {
// print all the decoded objects
print(decoded)
// print the decoded Data object at index 0
print("\n", decoded.data[0])
}
// Decoded objects:
/** Response(response: "Success", type: 100, aggregated: true, data: [
__lldb_expr_15.Level(time: 1514469240.0, close: 14090.41, high: 14119.99, low: 14077.700000000001, open: 14093.540000000001, volumefrom: 189.71000000000001, volumeto: 2696906.8399999999),
__lldb_expr_15.Level(time: 1514469420.0, close: 14127.84, high: 14131.190000000001, low: 14081.379999999999, open: 14090.41, volumefrom: 197.75999999999999, volumeto: 2805972.4399999999)]) */
// Data object at index 0:
/** Level(time: 1514469240.0, close: 14090.41, high: 14119.99, low: 14077.700000000001, open: 14093.540000000001, volumefrom: 189.71000000000001, volumeto: 2696906.8399999999) */
您应该执行preg_last_error()以了解失败的原因。