开发者

look behind for this REGEX?

开发者 https://www.devze.com 2023-03-11 00:09 出处:网络
im putting the delimiter i want to split by in caps just so they will stand out code should search for upper or lowercase

im putting the delimiter i want to split by in caps just so they will stand out code should search for upper or lowercase

$ReadStr = 'asbhd dbshd ABC/DEF sdjfhjskjhfh hfjhd fkj GHI/JKL sdhjkjhfg'; 

this is what I have...

$SplitStr = preg_split("[开发者_JAVA技巧.../+...]",$ReadStr);

print_r($SplitStr);

would output:

asbhd dbshd
sdjfhjskjhfh hfjhd fkj
sdhjkjhfg

just not sure how to implement the look behind the same exact regex expression...

this is the output i'm looking for:

asbhd dbshd 
ABC/DEF sdjfhjskjhfh hfjhd fkj 
GHI/JKL sdhjkjhfg


Use a look-ahead instead:

/(?=...\/+...)/

Or to be more specific:

/(?=[a-z]{3}\/+[a-z]{3})/i
0

精彩评论

暂无评论...
验证码 换一张
取 消