Python- Regex for dir of certain depth -


I have a regex expression but it is not working for all cases.

I need this to match any low level case to two levels of depth:

If this word is in the "test_word" statement then it is true.

What I am using is not working

  ('^ / [^ /] * / test_word..+')   

or

  ('^ / so I'm matching in statements with dirs like:  
  / user / test_word / test_word / test_word / Test_word /   

But this example is wrong because it's beyond two levels. Do not want to be positive for anything beyond

  / some / some / test_word /   

and whatever you think can happen / P>

I think you want something like that,

  ^ (?. *? / Test_word) (?!! *? //) \ / (?: [^ /] *) (?: / [^ /] *)? /? $   



Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -