Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 要在“n”之后删除所有内容/&引用;从记事本中的超链接++;或卓越_Excel_Replace_Notepad++ - Fatal编程技术网

Excel 要在“n”之后删除所有内容/&引用;从记事本中的超链接++;或卓越

Excel 要在“n”之后删除所有内容/&引用;从记事本中的超链接++;或卓越,excel,replace,notepad++,Excel,Replace,Notepad++,我需要一些帮助:寻找一种方法来删除超链接中第n次出现“/”后的所有内容(很可能是第4次或第5次)。例如,如果我有 https://www.forbes.com/forbes/welcome/?toURL=https://forbes.com/&refURL=&referrer= 我期望的输出是: https://www.forbes.com/forbes/welcome/ 此外,如果一个链接只有非常简单的公式,尽管我同意@Scott Holtzman的观点,在这里发布问题之前

我需要一些帮助:寻找一种方法来删除超链接中第n次出现“/”后的所有内容(很可能是第4次或第5次)。例如,如果我有

https://www.forbes.com/forbes/welcome/?toURL=https://forbes.com/&refURL=&referrer=
我期望的输出是:

https://www.forbes.com/forbes/welcome/

此外,如果一个链接只有非常简单的公式,尽管我同意@Scott Holtzman的观点,在这里发布问题之前,你应该付出一些努力。如果链接位于单元格
A1
中,请在Excel中的单元格
B1
中输入此公式

=IFERROR(LEFT(SUBSTITUTE(A1,"/","~~~~",5),FIND("~~~~",SUBSTITUTE(A1,"/","~~~~",5),1)-1)&"/",A1)
使用记事本++:

  • Ctrl+H
  • 查找内容:
    ^((?:[^/]*/){5})。*$
  • 替换为:
    $1
  • 检查环绕
  • 检查正则表达式
  • 不要选中
    。匹配换行符
  • 全部替换
说明:

^               : begining of lin
  (             : start group 1
    (?:         : start non capture group
      [^/]*     : 0 or more any character that is not a slash
      /         : a slash
    ){5}        : group must appear 5 times
  )             : end group 1
  .*            : 0 or more any character
$               : end of line
$1          : content of group 1 (ie. everything before the 5th slash)
https://www.forbes.com/forbes/welcome/
更换:

^               : begining of lin
  (             : start group 1
    (?:         : start non capture group
      [^/]*     : 0 or more any character that is not a slash
      /         : a slash
    ){5}        : group must appear 5 times
  )             : end group 1
  .*            : 0 or more any character
$               : end of line
$1          : content of group 1 (ie. everything before the 5th slash)
https://www.forbes.com/forbes/welcome/
给定示例的结果:

^               : begining of lin
  (             : start group 1
    (?:         : start non capture group
      [^/]*     : 0 or more any character that is not a slash
      /         : a slash
    ){5}        : group must appear 5 times
  )             : end group 1
  .*            : 0 or more any character
$               : end of line
$1          : content of group 1 (ie. everything before the 5th slash)
https://www.forbes.com/forbes/welcome/

通常,在Excel中很容易做到这一点(如果您知道Excel函数),但请向我们展示您尝试过的内容和不起作用的内容。你的问题表明你没有做任何研究工作,所以不是一个“嘿,为我做这个”的网站。程序员帮助程序员解决编程问题。