Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

How to find the ".java" file not ends with word "Process"

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to find the ".java" file not ends with word "Process"

For example

If there are two files

XyzProcess.java
XyzHolder.java

then the result should be

XyzHolder.java

I have tried using the regex "(?i).*?(^(Process))\\.java".

But its not working as expected.

Please suggest me what is wrong with it.

Thanks in Advance
Sankar K
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not just do a !endsWith("Process.java")?
 
Sankar Kuppusamy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for your reply.

Yeah!!! As you said we can achieve the same with endWith.

But I am learning the Regex stuff. For learning purpose i want to achieve the same using Regex.

Thanks,
Sankar
 
Marshal
Posts: 76489
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

r035198x wrote:Why not just do a !endsWith("Process.java")?

Please read the important administrative private message I just sent you.
 
Campbell Ritchie
Marshal
Posts: 76489
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sankar Kuppusamy wrote:But I am learning the Regex stuff.

I presume you are familiar with the Java™ Tutorials section?
 
Sankar Kuppusamy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Campbell Ritchie,

Yeah !!! While learning i came across various documents including the website which you have mentioned.

Based on the documents I have tried the above regex to solve my problem.

But Its not working as excepted. Also I could not figure out where the problem is.

That why i have raised this in forum.

Please help me if you know how to solve this problem.

Thanks,
Sankar.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sankar,

You can do this using negative look behind operator

"(?i).*?(?<!(Process))\\.java"

Here the above code check for the unavailability of word "Proccess" before ".java" file.


Regards,
Antany
 
Sankar Kuppusamy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks antany
 
They weren't very bright, but they were very, very big. Ad contrast:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic