如何从文本下方删除下标或上标?
[5] [6]在上标。
《博伽梵歌》介绍了印度教有关佛法的思想的综合[5] [6],[5] [6] [7]有神论的巴克提[8] [7]以及通往摩k教徒的瑜伽之路。[6]综合介绍了灵性的四个途径。
有什么办法找到它吗?
答案 0 :(得分:0)
<?php
// regex breakdown
// \[ matches the left bracket
// . any character except line breaks
// * 0 or more of the preceding character
// ? lazy matching
// \] matches the right bracket
$pattern = '/\[.*?\]/';
$replacement = '';
$subject = "The Bhagavad Gita presents a synthesis[5][6] of Hindu ideas about dharma,[5][6][7] theistic bhakti,[8][7] and the yogic paths to moksha.[6] The synthesis presents four paths to spirituality.";
$limit = -1;
$count = 0;
$result = preg_replace ($pattern, $replacement, $subject, $limit, $count);
?>
应该返回
《博伽梵歌》介绍了印度教关于佛法,有神论的巴克提以及通往摩k的瑜伽之路的综合思想。综合介绍了灵性的四个途径。