0
我對RegEx相對較新,需要幫助將兩段分隔符分開,然後捕獲它們之間的內容。舉例來說,我有一個具有「描述」屬性JSON對象,它主要包含這樣的文字:通過RegEx分割爲2個字符串分隔符Javascript
This is yet another test product to test for all sorts of styling/formatting issues.
PLACEHOLDER
PLACEHOLDER
PLACEHOLDER
******
Not so expensive
Works all day
Works throughout the night
No risk
100% Guarantee
------
This would be where ingredients would go for Test Product 4.
我所試圖做的是捕捉到六星號分隔符之間的「項目符號」名單和6點劃線分隔符。所以在上面的例子中,我希望能夠捕捉到這些線:
Not so expensive
Works all day
Works throughout the night
No risk
100% Guarantee
因此,我需要兩個分隔符拆分:
1) ******
2) ------
解決這個搜索和其他論壇後,我仍然似乎無法獲得任何形式的.split()方法和RegEx來獲得我想要的。有人能幫助我嗎?最終目標是能夠捕獲該文本,然後將其附加到<div>
@MikeM:忘記了這一點,但我的觀點仍然存在。 '/ - {6} | \ * {6} /'。它不太容易出錯。 – nhahtdh 2013-04-22 15:50:57
謝謝。這個def工作,但我已經嘗試過和其他解決方案。我現在意識到,這是一個以奇怪的方式包裝JSON數據並阻礙其發展的平臺。修復了這個問題。 – sean 2013-04-22 16:37:50