Monday 15 August 2011

regex - Regular Expression - Matching and extracting complicated conditions -


I am trying to write a regular expression which will match these conditions:

  • Maximum
  • Maximum of 10 lines (divided by \ r \ n).
  • Only the first 4 lines to remove from the matched text.

    This is not a good way to get ...: /

    Thanks!

    Regular expressions are not required for you. They are used with certain patterns , not fixed lengths if you are keeping the data in the string , then myString.length & lt; = 8000 You are required to count the alphabet (using the correct syntax for your language, of course). For the number of lines, you will have to count the number of sequences in your string in the \ r \ n (it can be reset). To get the first four rows, just search for 4 \ r \ n and get everything from a substring method first.

No comments:

Post a Comment