Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

Last post 08-21-2008, 8:47 AM by ddrudik. 13 replies.
Sort Posts: Previous Next
  •  08-20-2008, 3:17 PM 45505

    Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

    Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x.

     

    Thanks.

  •  08-20-2008, 3:24 PM 45506 in reply to 45505

    Re: Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

    What do you mean by "skips"?

    A more detailed explanation of what you're looking for would help.

  •  08-20-2008, 3:36 PM 45508 in reply to 45505

    Re: Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

    qwerty53:

    Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x.

     

    Thanks.

    http://regexadvice.com/blogs/mash/archive/2007/06/01/Are-you-ready-for-regex_3F00_.aspx

    I don't know what you are trying to do but it doesn't sound like a regex problem


    Michael

    "In theory, theory and practice are the same. In practice, they are not."
    Albert Einstein
  •  08-20-2008, 4:21 PM 45509 in reply to 45506

    Re: Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

    For example: from the string "zdfgdfgdfgz" I want to get "zz"
  •  08-20-2008, 4:27 PM 45510 in reply to 45509

    Re: Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

    What did you not understand about the request for a detailed explanation of your problem?
  •  08-20-2008, 4:31 PM 45512 in reply to 45510

    Re: Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

    prometheuzz:
    What did you not understand about the request for a detailed explanation of your problem?

    I want to capture all chars but those I skip

  •  08-20-2008, 4:38 PM 45513 in reply to 45512

    Re: Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

    qwerty53, you cannot skip characters in a capture group (in your case capture group 0), the best you can do is create capture groups with ( ) such as:

    (z)[^z]*(z)

    capture groups 1 and 2 are your target.


  •  08-20-2008, 4:40 PM 45514 in reply to 45510

    Re: Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

    prometheuzz:
    What did you not understand about the request for a detailed explanation of your problem?

    I can understand your frustration but patience is the key to answering questions here.


  •  08-20-2008, 4:41 PM 45515 in reply to 45512

    Re: Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

    qwerty53:

    prometheuzz:
    What did you not understand about the request for a detailed explanation of your problem?

    I want to capture all chars but those I skip

     If that is the best explanation you can give, I'm out.

     Good luck.

  •  08-20-2008, 4:54 PM 45517 in reply to 45514

    Re: Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

    ddrudik:

    prometheuzz:
    What did you not understand about the request for a detailed explanation of your problem?

    I can understand your frustration but patience is the key to answering questions here.

     What do you mean by "here"? Is this forum some special place on the internet?

    I asked the OP a question which he either ignored, or didn't understand. If it was the latter, s/he just needed to ask for clarification instead of mindlessly posting another nonsensical one-line-question.

    With all due respect: as long as I am not abusive towards other forum members (which I'm not, IMO) and what I post is "on topic", I will post whatever I like. Thank you.

  •  08-20-2008, 5:06 PM 45518 in reply to 45509

    Re: Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

    qwerty53, if you want to match as your described in the title of the question you would need to use capture groups and then replace capture group 0 with the three capture groups used:

    $sourcestring before replacement:
    1x2x3x4x5x6x7x8x9x

    Raw Match Pattern:
    ((?:.*?x){3}).*?(x(?:.*?x){3}).*?(x.*)

    Raw Replace Pattern:
    $1$2$3

    $sourcestring after replacement:
    1x2x3xx5x6x7xx9x


  •  08-20-2008, 6:58 PM 45520 in reply to 45517

    Re: Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

    prometheuzz:
    ddrudik:

    prometheuzz:
    What did you not understand about the request for a detailed explanation of your problem?

    I can understand your frustration but patience is the key to answering questions here.

     What do you mean by "here"? Is this forum some special place on the internet?

    I asked the OP a question which he either ignored, or didn't understand. If it was the latter, s/he just needed to ask for clarification instead of mindlessly posting another nonsensical one-line-question.

    With all due respect: as long as I am not abusive towards other forum members (which I'm not, IMO) and what I post is "on topic", I will post whatever I like. Thank you.

    I think you may have misinterpreted my comment.  My comment was not directed at your choice of words.  My point was that there are many askers who visit "here" (this forum) and ask questions without having a full command of the basics of the forum (maybe it's due to a basic spoken language barrier or just ignoring the posting rules).  In any case, most of those that visit ask a question with less than full information and after they receive some sort of answer they never return.  While I would like full information at the first post as is requested at the top of the forum, I have come to realize if I want to answer the questions it takes patience to work with the asker.  That's all, nothing much else to be read into my comment.


  •  08-21-2008, 3:05 AM 45527 in reply to 45520

    Re: Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

    ddrudik:

    ...

    I think you may have misinterpreted my comment.  My comment was not directed at your choice of words.  My point was that there are many askers who visit "here" (this forum) and ask questions without having a full command of the basics of the forum (maybe it's due to a basic spoken language barrier or just ignoring the posting rules).  In any case, most of those that visit ask a question with less than full information and after they receive some sort of answer they never return.  While I would like full information at the first post as is requested at the top of the forum, I have come to realize if I want to answer the questions it takes patience to work with the asker.  That's all, nothing much else to be read into my comment.

     Thank you for your (calm) explanation: I misinterpreted your reply. Please accept my apologies for my snippy answer!

  •  08-21-2008, 8:47 AM 45535 in reply to 45527

    Re: Expression that skips the chars between 3rd and 4th and between 7th and 8th occurrences of x

    No worries here.
View as RSS news feed in XML