如何在文本塊中查找路徑和文件名?正則表達式在文本中查找目錄
您標記這是重複之前,我知道有關文件路徑的問題存在
- Regex for parsing directory and filename(不段落相匹配。)
- Regex that matches directory path excluding filepath(這只是一個相匹配的文件名,答案不段落的工作,並沒有解決
.
或空格)
- java regular expression to match file path(不涉及
.
或空格)
- Regex for extracting filename from path(不涉及段落是)
例如
In file included from /some/directoy/3.33A.37.2/something else/dogs.txt,
from /some/directoy/something else/dogs.txt,
from /some/directoyr/3.33A.37.2/something else/dogs.txt,
from /var/log/xyz/10032008.log,
from /var/log/xyz/test.c:29:
Solution:
please the file something.h has to be alone without others include, it has to be present in release letter,
in order to be included in /var/log/xyz/test.c and /var/log/xyz/test.h automatically
Other Note:
The file something.c must contain the somethinge.h and not the ecpfmbsd.h because it doesn't contain C operative code.. everything good..
以下是理想的匹配:
/some/directoy/3.33A.37.2/something else/dogs.txt
/some/directoy/something else/dogs.txt
/some/directoyr/3.33A.37.2/something else/dogs.txt
/var/log/xyz/10032008.log
/var/log/xyz/test.c:29 (this is a tricky one, ok with out it)
/var/log/xyz/test.c
/var/log/xyz/test.h
進一步說,如果我找到什麼答案怎麼能我更改它與\
而不是/
目錄
您可以快速做出更改。 – Whitecat 2015-03-18 22:03:28
@Whitecat大聲笑,我喜歡正則表達式和發現模式 – 2015-03-18 22:08:23
這有一個問題,如果我有這個'something /var/log/xyz/10032008.log lude,它必須出現在發佈信中,才能包含在/var/log/xyz/test.c:54546自動' – Whitecat 2015-03-18 22:20:29