我有一个大问题。我在灾难性回溯(http://www.regular-expressions.info/catastrophic.html)中进行了一次验证。但我很难弄清楚为什么。也许有人有想法?除此之外,正则表达式适用于所有用例。
regex: "^((^|[^A-Za-z]+)[A-Z][A-Za-z]*)*[^A-Za-z]*$"
问题输入:
"Disposable
BHT,
Tocopheryl AcetateHydrating Shave Gel
Aqua,
Glycerin,
Palmitic Acid,
Triethanolamine,
Isopentane,
Glyceryl Oleate,
Stearic Acid,
Isobutane,
Sorbitol,
Parfum,
Hydroxyethylcellulose,
Myristic Acid,
PEG-90M,
Butyrospermum Parkii Butter Extract,
Lauric Acid,
PTFE,
PEG-23M,
Propylene Glycol,
Glyceryl Acrylate/Acrylic Acid Copolymer,
PVM/MA Copolymer,
Silica,
Methylparaben,
Propylparaben,
BHT,
Limonene,
Benzyl Salicylate,
Linalool,
CI 42053,
CI 42090
Series Thermal Face Scrub
PEG-4,
Magnesium Sulfate,
PEG/PPG-300/55 Copolymer,
Polyethylene,
Polypropylene,
Laureth-23,
Stearyl Alcohol,
Dioleoylethyl Hydroxyethylmonium Methosulfate,
Cetyl Alcohol,
Behentrimonium Chloride,
Distearyldimonium Chloride,
Hydroxypropylcellulose,
Parfum,
Methylparaben,
Propylparaben,
Niacinamide,
Alcohol Denat,
Hexylene Glycol,
Benzyl Salicylate,
AquaClassic Clean Shampoo
Aqua,
Sodium Lauryl Sulfate,
Sodium Laureth Sulfate,
Glycol Distearate,
Zinc Carbonate,
Sodium Chloride,
Sodium Xylenesulfonate,
Zinc Pyrithione,
Cocamidopropyl Betaine,
Dimethicone,
Sodium Benzoate,
Guar Hydroxypropyltrimonium Chloride,
Hydrochloric Acid,
Hexyl Cinnamal,
Linalool,
Butylphenyl Methylpropional,
Magnesium Carbonate Hydroxide,
Ammonium Laureth Sulfate,
Magnesium Nitrate,
Sodium Polynaphthalenesulfonate,
Methylchloroisothiazolinone,
Magnesium Chloride,
CI 42090,
Citric Acid,
Methylisothiazolinone,
Tetrasodium EDTA,
CI 17200,
DMDM Hydantoin Perspirant Deodorant Spray Sport Protect 48H
Butane,
Isobutane,
Cyclopentasiloxane,
Aluminum Chlorohydrate,
Cyclodextrin,
Disteardimonium Hectorite,
Dimethicone,
Aqua,
Triethyl Citrate,
Alpha-Isomethyl Ionone,
Butylphenyl Methylpropional,
Citral,
Citronellol,
Coumarin,
Geraniol,
Limonene,
Linalool
Pillite Series Instant Hydration Moisturiser +SPF 15
Aqua,
Glycerin,
Ethylhexyl Salicylate,
Niacinamide,
Butyl Methoxydibenzoylmethane,
Dimethicone,
Polyethylene,
Octocrylene,
Isopropyl Palmitate,
Phenylbenzimidazole Sulfonic Acid,
Sorbitan Stearate,
Triethanolamine,
Cetyl Alcohol,
Sodium Acrylates Copolymer,
Aluminum Starch Octenylsuccinate,
Stearyl Alcohol,
Caprylic/Capric Triglyceride,
Panthenol,
Benzyl Alcohol,
Dimethiconol,
Fragrance,
Ethylparaben,
Cetearyl Glucoside,
Cetearyl Alcohol,
PEG 100 Stearate,
Propylparaben,
Disodium EDTA,
C12-13 Pareth-3,
Palmitic Acid,
Stearic Acid,
Benzyl Salicylate,
Laureth-7,
Linalool,
Butylphenyl Methylpropional,
Myristic Acid,
Coumarin,
Heptadecanoic Acid,
Benzyl Benzoate"
谢谢!