regex - Is Regular Expressions the best way to go about matching and replacing text? -


I have a regular expression, so please avoid giving me a definition. I'm only looking for an opinion, and maybe even some advice. I am graduating soon with my degree in computer science, and at this point, I have got on regular expressions, only through a course on education, PL design and development. We actually have not really educated about the actual application and the program itself, using the Reggae with the programming language, which we are writing.

I have a question, am I right, Regex is the most powerful tool in Milan, and dealing with text? If I am wrong, then what happens there that I should teach myself (as opposed to being good with the reges)? In addition, any Eclipse knows any good Regex plugins for the IDE (preferably Galileo). I am looking for something that allows me to test the document and focus on what is probably being done. Thanks

It depends on what it means to be powerful.

In the complexity period, Regx can hardly handle recursive, for example, you need to do something like Compiler Generation, such as Java CC or YACC is the reason that you are full Can not easily make XML parser from RegEx easily. Things RFX are refined for a long time.

In the period of display, Regx can not compete directly with parsing. For example, if you want to see that the string word starts with "prefix"; In RegEx you can find ' / ^ prefix. * / but you go to non-reggax java ' Str.startsWith ("prefix") ' The speed of both is incomparable.

However, RegEx makes the code much more manageable in many cases. The easiest example to look at is that if you want to see that the string has at least 10 numbers; In Java, you can type:

 for  (int i = 0; i & lt; math.man (10, strath lambon); i ++) {char C = Str. CharAt (i); If ((c & lt; '0') || (C & gt; '0')) Wrong rearrangement; } Back true;  

Compares RegEx:

  Fixed final string checkrgex = "^ [0- 9] {10,} +"; // then you have expressed it in a fixed static final string checkpath = Pattern.compile (CheckRegEx); RegEx is more manageable with code (checkmarket matches (ARR)) {// match}  

.

What I am trying to say is that every technique has trade-offs and should balance them.

In most cases, RegEx is a very good tool for the tasks designed to do this.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -