2016-05-28 38 views
2

我要插入的所有類,並在數據庫中的行CSS文件的ID,正則表達式的CSS class和id

html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,dl,dt,dd,ol,nav ul,nav li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline;} 
article, aside, details, figcaption, figure,footer, header, hgroup, menu, nav, section {display: block;} 
ol,ul{list-style:none;margin:0;padding:0;} 
.subscribe p{ 
.txt-rt{text-align:right;} 
.pos-relative{position:relative;} 

從訂閱PI只想要訂閱非p所以基本上我找的一些正則表達式,將過濾.{或空間之間的元素從每個類:

.txt-rt{text-align:right;} 

我不得不.{

之間和用於搜索
.subscribe p{ 

我有.和空間

+0

也許像'[。#]([\ w .-] +)''? https://regex101.com/r/xB0dZ6/1在第一組規則中,您希望找到什麼? – chris85

+0

我希望這些項目被輸入在mysql – tumbin

+0

的一行中,請把它作爲答案,我會接受。它解決了我的問題 – tumbin

回答

0

此正則表達式之間的搜索應該能找到你的樣式表class和id。

[.#]([\w.-]+) 

演示:https://regex101.com/r/xB0dZ6/1

它幾乎說,字符串必須以#.上啓動,然後至少包含一個字母數字字符,.-,或_

您可能需要添加起始錨或尾隨檢查.*?{。與

marque { 
    width: 2.2px 
} 

.2px將符合此規則。