Regular expression to search if a word occurs with z and /z tags

Hi ,
I am trying to create a regex to search for the occurence of two words within <z> and </z> tags.(they must occur between <z> and and next immideate </z> tags)
This is my regex
<z>\s[\w\W]+?(?!</z>)word1[\w\W]+?(?!</z>)word2[\w\W]+?</z>|<z>\s[\w\W]+?(?!</z>)word2[\w\W]+?(?!</z>)word1[\w\W]+?</z>
I am trying to specify (?!</z>) in order that i insist that my regex engine does map for word1 and word2 within <z> and its next immideate </z> tags. The words can appear either ways word1 followed by word2 or vice versa.
The above regex does not work fine.
It maps fine for the following sentence
<z> This is test for pattern for a Regex </z> <z> Also we would like to conclude what is happening </z> <z> Another test for paragraph is happening </z>
The regex is as follows
<z>\s[\w\W]+?(?!</z>)pattern[\w\W]+?(?!</z>)Regex[\w\W]+?</z>|<z>\s[\w\W]+?(?!</z>)Regex[\w\W]+?(?!</z>)pattern[\w\W]+?</z>
But, when i include the </z> in between pattern and Regex , it should not match, but that is not what is happening.
<z> This is test for pattern </z> for a Regex</z> <z> Also we would like to conclude what is happening </z> <z> Another test for paragraph is happening </z>
Please let me know how I can accomplish the same.
Thanks.

oops.. sorry ..this is aligned better ...
Hi , I am using this regex
(?=(?:(?!</z>).)+?\bpattern\b.+</z>)(?!(?:(?!</z>).)+?\bscientific\b.+</z>)((\bpattern\b(?:(?!</z>).)+)\bpattern\b|\bpattern\b)I have written the above regex to match pattern between <z> and </z> provided there is no word "scientific" within that "z" tags.
I have been trying to replace the regex to do the same between two sentences, here in my case I have a paragraph with multiple sentences. The delimiter to determine a sentence is dot (.). So i am trying to specify the condition as above to match between two sentences - using representation for dot as (\. )
The following is my regex
(?=(?:(?!\.).)+?\bpattern\b.+\.)(?!(?:(?!\.).)+?\bscientific\b.+\.)((\bpattern\b(?:(?!\.).)+)\bpattern\b|\bpattern\b) But this does not work..
Can you please tell me how to go about this?
Thanks.

Similar Messages

  • When I turn on firefox the sound of an alarm begins and keeps going. I did not download or add or open anything. A sound like the old pacman game initiates the never ending alarm. It does not occur with safari and ends if I close firefox.

    When I turn on firefox the sound of an alarm begins and keeps going. I did not download or add or open anything. A sound like the old pacman game initiates the never ending alarm. It does not occur with safari and ends if I close firefox.
    == This happened ==
    Not sure how often
    == I opened firefox

    dont have google open in a tab!!!!!!!!
    (if you are one who opens FF and it opens google then immediately open another tab to go to a site then just visit the site from the page that opened without opening a new tab)
    OR
    if you have cool preview then disable that
    (the sound is for the celebration of 30 years of pacman and you can play the game on google's homepage)

  • Back reference for regular expressions on "Search & Replace".

    Can't I reference a result from my Regular Expression used on "Search Clause" into my "Replace Clause"?
    What I'm doing is:
    Using JDev 10.1.3 DP,
    Search Menu -> Replace in Files...
    Select "Regular Expressions"
    Text: (A[0-9]*?_)(.)
    Replace with: $2 (reference to the second Parenthesis in the "Text" Field).
    For example, in Java, I would so something like this:
    "Dummy String".replaceAll("(D.*? )(S)", "$2");
    Are there any other ways that I can just Search something and Replace for nothing? I need a simple "Search and Delete", you know?
    If I don't do that and try to leave it blank, a warning comes up saying that the "Replace with" field cannot be blank.
    Any sugestions?

    BOUNCE!
    Please, anyone?
    Will I really have to delete 1200 occurrences by hand???
    :(

  • Regular Expression - replaceAll() - how to replace words?

    Hiya,
    I have this regex to replace all instances of myWord:
    String oldWord = "oldWord";
    String newWord = "newWord";
    String sentence = "some sentence that contains " + oldWord;
    String newSentence = replaceWordsInSentence(sentence, oldWord, newWord);
    private String replaceWordsInSentence(String sentence, String oldWord, String newWord) {
        return sentence.replaceAll("\b" + oldWord + "\b", newWord);
    }...it works in most instances, but when oldWord is at the end of the sentence it is not replaced. Presumably the problem is that "/b" is not a sufficient word boundary. Can someone help me out with the correct regular expression code?
    Thanks,
    James

    Mel, you did appear to misunderstand as you thought points 2 and 3 were alternatives, but you now recognise that they are additional "shoulds".
    Of course, I applied the extra backslash as soon as Joachim advised. Maybe you don't agree with my rationale, but I prefer the complete solution that will work in all instances... so was simply waiting for him to post a code example that included the latter 2 points as (although I understood the point of them perfectly) I was not sure how to implement them.
    Have come up with the following, expanded, method...
        private String replaceWordsInSentence(String sentence, String oldWord, String newWord) {
            return sentence.replaceAll("\\b" + Pattern.quote(oldWord) + "\\b", Matcher.quoteReplacement(newWord));
        }...works fine with the tests I have run. Joachim, can you confirm this is correct.

  • Regular expression-- How to match whole word

    I use java.util.regex in my case,
    my problem is following:
    here is a sentence: "oRs As ordoRs"
    i use this pattern: (?!\w)oRs(?<!\w)
    the first word oRs should match, but why the third word also match?
    Maybe my problem also could be scribled as following:
    How to match whole word?

    here is a sentence: "oRs As ordoRs"
    i use this pattern: (?!\w)oRs(?<!\w)
    the first word oRs should match, but why the third
    word also match?What's even more interesting, there should be no matches at all! Just because the pattern is inherently inconsistent:
    the (?!\w) requires the next char to be a non-letter, but
    at the same time this char is reqired to be a letter 'o'.
    The same thing in the end: the last char should be 's' but not a letter. So the pattern must match nothing.
    Maybe my problem also could be scribled as following:
    How to match whole word?It's simple, use word boundaries - either directed ( "\<" and
    "\>") or undirected ("\b").
    The word pattern will look like "\b\w+\b" or "\<\w+\>"
    Test it here
    http://jregex.sourceforge.net/demoapp.html

  • Regular Expression to Search Comma Delimited File for any of 3 Values

    Hi,
    I'd like to parse a table column that contains a comma delimited string for any of 3 values, 1200, 1400, 1600 just to see if they're present using Regexp_instr. If someone has an expression available please pass it along.
    Thanks,
    Victor

    Or you could do it like this too...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as id, '1000,2000,3000' as txt from dual union all
      2             select 2, '1200,1300,1400' from dual union all
      3             select 3, '1000,1300,1600' from dual)
      4  -- end of test data
      5  select *
      6  from t
      7* where regexp_like(txt,'(^|,)(1200|1400|1600)(,|$)')
    SQL> /
            ID TXT
             2 1200,1300,1400
             3 1000,1300,1600

  • Regular Expression / String matching other than equality check with groovy.

    I want to have a string comparison operation using a groovy expression.
    Not an equality check, but something like
    #{variableName like 'IC%'?'true':'false'}
    I saw some operators like
    #{bindings.gradeName.inputValue =~ 'IC'?true:false}
    But it doesnt seem to be working.
    Is it possible with groovy?
    Arun

    Hi
    nything will do.
    And not using bean.
    This expression has to added in an AMX page (ADF Mobile
    It depends on where you want to execute this. Groovy in a validation script would be different to EL in a page as they would be in different stages in the lifecycle.
    Now for ADF MObile this may be different, I dont know.'
    If its to be part of a validation then you can call the source methods in groovy and do the comparison.
    from a validator for instance:
    source.getGradeName() returns the grade name before commiting.
    String enteredgrade = source.getGradeName();
    if (enteredgrade.index(0).equals('I') and enteredgrade(1).equals('C'){
    do what you want here. i.e. return true or false etc.
    el in a page would look entirly different but you can implement this same functionality in a bean, access it via the accessors and then return true or false.
    if you are already using EL and you managed to link your page with JSTL, you will have to define the access variable in the header section inorder to access it and then use "startswith", though I havent tried it this way.

  • Is there a way to convert a Word document with Red and Black into Spot colors in Acrobat X?

    Customer sent us PDF files created in MS Word. Of course, Word creates CMYK versions of colors. I need the red text and black text converted into spot colors for 2 color output on press. Is there a way to do this? I saw another thread that said there is a Fixup in the Print Production/Preflight section of Acrobat X that has a convert to Spot, but I'm not seeing that. All I see is Convert to CMYK. I'm using Acrobat X 10.1.13 on OS X. Any help would be appreciated. He also sent the Word docs so I can drop that into InDesign and reformat the whole thing and fix the colors myself but if I can do it in Acrobat, that would be a lot quicker. Thanks!

    Frequently in this scenario the red will be 100% of either magenta or yellow with 0% black. In these cases you can merely plate the Black & Magenta (or yellow) for press.
    I've created a Preflight Fixup on occasion for these also.
    An example shown - Note it requires the document is cmyk. MS Files will be rgb. You could create a Preflight looking for rgb colors.
    With Fixup tab selected - Options > Create New Fixup > Type of Fixup - search for Spot in the field

  • Search Help Parameter Default - Problems with VKO and VTW in Sales Order

    Hello,
    we've implementend an own serchhelp for the material-search.
    The fields VKORG and VTWEG have the default VKO and VTW.
    If I open this searchhelp in VA03 those values are not filled, if I open it in MM03 or ME23N those values are filled.
    My user has the VKO and VTW-parameters set.
    We have no custom "preselect-code" implemented.
    If I change the values to VKU and VTW the output is the same (works in MM03 / ME23N but not in VA03) (copied default values from MAT1S search help, didn't change my user parameters!)
    What could be the problem?

    Our searchelp was in our own append ZA_SD_MAT1.
    Solution:
    We deleted this append and added our search-helps to SD_MAT1 and now everythings works in mm03, me23n and va03.

  • Word .docs with Horizontally and Vertically oriented pages

    I have 30 plus Word .docs that have Horizontally and Vertically oriented pages in them. A new PDF is created each time the orientation changes. Is there a way to have Acrobat keep those in the same PDF?
    I am using Acrobat Pro for Mac 10.1.10

    As far as I know there are no patches available for the software and OS I am using (I ran the update check on each), but my version of Acrobat Pro is older.
    OSX 10.9.4 Mavericks
    Acrobat Pro for Mac 10.1.10
    Word 2011 14.4.3 (140616)

  • Word processing with superscripts and subscripts.

    Is there a word processing app for the iPad yet which does superscripts and subscipts?
    (Discussions on this subject were posted on this website about a year ago, has the no superscipt button and no subscript button problem been fixed yet?)

    I've found a possible solution to insert equations and formulas without Latex or copy/paste images, only with Pages for iPad and without internet, using Pages tools. So, I have some examples of Pages documents. If you want to take a look them, give me your email and I'll send you an example.

  • Word wrapping with JTextPane and styleDocument

    Hello,
    Can someone help me with the following problem.
    I have a JTextPane where i add a styledDocument.
    If i fill this with text it doen't word-warp the text!
    import javax.swing.JTextPane;
    import javax.swing.text.BadLocationException;
    import javax.swing.text.Style;
    import javax.swing.text.StyledDocument;
    public class LogField extends JTextPane implements LogFileTailerListener{
         public static StyledDocument doc;
         private LogFileTailer tailer;
         private TextStyles styles;
         public LogField(){
              this.setEditable(false);
              this.setContentType("text/html");
              doc = (StyledDocument)this.getDocument();
              styles = new TextStyles();
              tailer = new LogFileTailer( LogPanel.logFileName, 1000, true );
              tailer.addLogFileTailerListener( this );
             tailer.start();          
         public void addText(String text, Style style){     
               try {
                  text = text + System.getProperty("line.separator");
                   doc.insertString(doc.getLength(), text, style);
              } catch (BadLocationException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              this.setCaretPosition(doc.getLength());
         @Override
         public void newLogFileLine(String line) {
                addText(line,styles.getDefaultStyle());
    }

    Since you are simply appending text to the Document you should not be using a type of "text/html".
    If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.

  • Importing a large MS Word file with tables and graphics into InDesign CC

    I have a large (300 page) Word file, either doc or docx and I'd like to import it into InDesgn to convert to a Kindle book.  I'm very new to InDesign.
    Thanks
    Derm

    You'll need to learn InDesign before you even think about going to epub.
    Books:
    Sandee Cohen's Visual Quick Start Guide: http://amzn.to/14JHq54
    Digital Publishing with Adobe InDesign CS6 : http://amzn.to/13N06jN
    Lynda.com: Here's a link for a one week trial: http://bit.ly/RS0GXs
    Oh, and to answer you question, use file>place and then browse to the
    Word file. Then shift click on the first page of the InDesign to
    automatically create enough pages.

  • Linked Word doc with headings and the TOC

    I'm relatively new to RoboHelp, so bear with me.
    I'm linking in a Word document that is being maintained by others. The document uses Heading 1 styles for auto-numbered chapters, thus:
    1 Some topic
      lorem ipsum, etc
    2 Some other topic
      lorem ipsum, etc
    To get the 2 chapters into my TOC I create a book from the page and configure my SSL to use that TOC. So far, so good - the TOC appears as I desire. WIthin the document, however (I'm generating PDF) I get both the book name and the heading that is embedded in the text, thus:
    1 Some topic
      1 Some topic
         lorem ipsum, etc
    I'm just not seeing how I'm supposed to set this up so that I can avoid the duplicates, given that I really want to stay linked to the original word document rather than just doing a one-time import and then manually editing the resulting html file.
    I'm using v9 on Windows 7.
    Thanks

    Hi there
    So let me get this straight. You have a Word document. You suck it into RoboHelp to create HTML. Then you create a completely different Word document using RoboHelp that is then used to create a PDF.
    Why not simply create the PDF from the original Word document? Seems more straightforward to me.
    Your present workflow (using an analogy) is like this: You are baking a cake. You take the flour and eggs and milk and blend them and bake the cake. Then you take that baked cake and break it up to try and get flour and eggs and milk back out of it and you dislike the fact there are all these crumbs to deal with!
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7, 8 or 9 within the day!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • Word 2000 with SolMan and EWA issues

    Hi,
    Having a number of issues. It seems since updating SolMan to SP24 EHP1 i cannot open EWA reports in Word 2000 (updating to latest version is out of the question due to business politics). I have tried a number recomendations from OSS notes but none work. I get this error message when i select standard or short version
    Required file not found -> see long text
    Message no. DSVAS813
    No usable file was found for the active Office version in the report defintion.
    Procedure
    Processing cannot continue.
    Please notify the person responsible for this session type or for the SAP Solution Manager, specifying the session number, session group, session type, version number and the number of the message short text.
    To find session information, in the Service Session Workbench, choose Goto -> Technical Information. Specify the Office application and version (which you can find by choosing ? -> Help -> About... ) and the number of the message short text.
    To create a message to SAP, choose Help -> Create Support Message.
    The issue can be resolved by changing the report definition in the Service Session Workbench or importing a newer version of the session definition.
    I am not sure how to change the Word version in technical Information, it seems not so "helpful" help page and how to change the report definition. Any help on this would be appreciated
    I also needed to know how to send previous SAP EWA reports. The landscape is setup to send the EWA reports to SAP on a monthly basis and i need to change this to weekly. i have had a look at the EWA setup operations and it is active and all boxes are ticked.
    thanks,
    Mani

    Hello Mani,
    You can send the data for ABAP system to SAP and process the EWA reports and they can be accessed via your
    Service Market Place inbox, if that was an option you were seeking. How to do so, you need to follow SAP Note 207223.
    The periodic SDCCN EWA task can be scheduled to recurr weekly.
    EWA data on Satellite ssytems is usually only available for the past 3 weeks, as there is no intent to store the data.
    Of course any EWA report can also be opened (click the link on the left side in DSWP) in HTML, so this could be a work around to get any existing or furture EWA reports generated on your Solution Manager system.
    Unfortunately, because Word 2000 is no longer supported by Microsoft, there is little that can be done now, that you are on Word 2000, and have upgraded to an SP level that no longer supports Word 2000. This is your issue.
    However I think I have provided some alternatives to get the reports.
    Regards,
    Paul

Maybe you are looking for