Regex获取特定单词前的单词首字母(php)


Regex get first letter of a word before a specific word (php)

php中有以下字符串:

$text = "此价格不包括增值税和某某某某某某......";

和regex的开头:

preg_match("/(--not sure what goes here--)(?: vat)/", $text, $vatStatus);

基本上,我想获得vat之前的单词的第一个字母(在这种情况下是字母'e')。

提前感谢您的帮助。

p。解决方案需要在regex中,而不是在任何其他PHP函数中。

谢谢

/'b('w)'w*?(?: vat)/