Pattern matching and homesite 5.5?

Hello,
Is it possible to use pattern matching to change a whole
series of instances
similar to the one below?
<a name="track-records"><h2>Assignment Track
Records</h2></a>
to
<a name="track-records"></a>
<h2>Assignment Track Records</h2>
I need to be able to transfer the text between the <h2>
and </h2> tags
to the next line...
Can I use $1, $2 etc?
Cheers
Geoff

<a name="track-records"><h2>Assignment Track
Records</h2></a>
becomes
<a name="track-records"><h2>Assignment Track
Records</h2></a>
I assume you want to do this for a number of different h2
elements?
i have had success with backreferencing bracketed expressions
as follows:
find: <a name="track-records"><h2>(pattern for
your h2 text)</h2></a>
replace with:
<a name="track-records">
<h2>\1</h2></a>
the carriage return is manually entered, and \1
backreferences the result of the pattern matched by first bracketed
expression. similarly use \2 and \3 for second and third bracketed
patterns.
i could not tell you how to match a line break / carriage
return - the help only tells you how to match everythin but a line
break or carriage return - something like #chr(10)##chr(13)# but
don't quote me on that...
owen

Similar Messages

  • Pattern Matching and Vision Builder 6.0

    Hi,
    When I select a ROI from an image to generate a pattern matching, Builder
    saves it as a PNG file.
    If I open this pattern in other application (Paint Shop Pro 7) to modified
    it and save as a PNG file, after I can't open this file as a pattern into
    Builder, because it is considered as a not valid PNG file.
    I have tested this case in LabView 6.i and this problem doesn't appear.
    Any solution? Thanks.

    When the template is first saved in Vision Builder, pattern matching information is stored in the header of the PNG file. This information lets LabVIEW and Vision Builder know how the template was learned. Paint Shop Pro does not keep this information in the file whenever it is saved so Vision Builder will not recognize it as a valid pattern matching template.
    Jack Arnold
    Application Engineer
    National Instruments

  • Pattern Matcher and replaceAll

    Hi,<p>
    I have a program that takes a longString, searches it for instances of a searchTerm and then replaces the match with a formatted version of the match (for highlighting in results page). It works, however, if the search term from the user is "java" and the found term within longString is "Java" then the returned highlighted string ends up being "<b>java</b>" when I need to preserve the true case of the letters, just need to format the word. <p>
    I've searched and searched for a way to do this, but seem only to be able to do the case_insensitive search, not case_insensitive replace. Any ideas? Here's a snippet of the code:<p>
    String phrase = foundPhrases.get(m);<p>
    Pattern firstMatchedPattern = Pattern.compile(phrase, Pattern.CASE_INSENSITIVE);<p>
    Matcher matchedPhrase = firstMatchedPattern.matcher(highlighted);<p>
    while (matchedPhrase.find() == true) {<p>
    String origPhrase = origPhrases.get(m);<p>
    phrasePos = highlighted.toLowerCase().indexOf(origPhrase.toLowerCase());<p>
    phraseLen = origPhrase.length(); // do not count any backslashes<p>
    String thisPhrase = highlighted.substring(phrasePos, (phrasePos + phraseLen));<p>
    StringBuffer hilitebuffer = new StringBuffer(CoreServices.highlightTagStart);<p>
    hilitebuffer.append(thisPhrase);<p>
    hilitebuffer.append(CoreServices.highlightTagEnd);<p>
    String hilitePhrase = hilitebuffer.toString();<p>
    //highlighted = matchedPhrase.replaceAll(hilitePhrase);<p>
    highlighted = highlighted.replace(thisPhrase, hilitePhrase);<p>
    }<p>
    ...<p>
    Thanks,
    Ginni
    Message was edited by:
    ginnim

    Okay, one more glitch. When I run the code with the string to search being "rollerblading" and the search term as "blading" I end up with rolle<b>blading</b> in the UI. I ran this through the debugger step by step. Here's the code snippet (modified for my app):<p>
                // Now the highlighting portion              
                /** The temporary start tag, just some uncommon Unicode character. */
                final String START_TAG = Character.toString( (char)0x0141 );
                /** The temporary end tag. */
                final String END_TAG = Character.toString( (char)0x0142 );
                String highlighted = result.toString();
                for (int m = 0; m < foundPhrases.size(); m++) {
                    String phrase = foundPhrases.get(m);
                    String pattern = "[^" + START_TAG + "](" + phrase + ")";
                    Pattern firstMatchedPattern = Pattern.compile( pattern, Pattern.CASE_INSENSITIVE );
                    Matcher matcher = firstMatchedPattern.matcher( highlighted );
                    while( matcher.find( ) ) {
                        String foundPhrase = matcher.group( 1 );
                        StringBuffer hilitebuffer = new StringBuffer( START_TAG );
                        hilitebuffer.append( foundPhrase ).append( END_TAG );
                        System.out.println("hilitebuffer = " + hilitebuffer.toString());
                        //highlighted = highlighted.replaceAll( foundPhrase, hilitebuffer.toString( ) );
                        highlighted = matcher.replaceAll(hilitebuffer.toString());
                        //matcher.reset( highlighted );
                    highlighted = highlighted.replaceAll( START_TAG,
                          CoreServices.highlightTagStart );
                    highlighted = highlighted.replaceAll( END_TAG, CoreServices.highlightTagEnd );
                System.out.println( "highlightMatchingPhrases.return: " + highlighted );
                return highlighted;<p>
    I verified "highlighted" starts out with the value "rollerblading" and when I step into the line highlighted = highlighted.replaceAll( START_TAG,
                          CoreServices.highlightTagStart ); I end up with highlighted containing the value "rolle< b ... >blading< /b >". Do you think String has a bug with the replaceAll method? Or am I missing something about that method...? <p>The java spec claims that Matcher's replaceAll method mimics exactly what String's replaceAll method does. However, if I replace the line highlighted = matcher.replaceAll(hilitebuffer.toString()); with the commented line highlighted = highlighted.replaceAll( foundPhrase, hilitebuffer.toString( ) ); and then I search for "blading" my result is proper: roller<b>blading</b><p>

  • How to calibrate, create template for pattern matching and find distance between patterns.

    The question is already in topic.
    I have tried it for several time but haven't succeeded.
    My tried (http://www.zone.ee/mahb02/main.vi)
    One problem is how to to calibration with first picture only, cause other pictures don't have ruler.
    Pictures are shown in http://www.zone.ee/mahb02/
    I would aprichiate if anyone would help me.
    E.

    Hi E.
    You may want to contact that website to ask about those VIs.
    Charlie M. CLD

  • How do I set multiple pattern matching Vi's and make overlappin​g pattern matches to count as one?

    Hello! I'm a student and I'm currently making a project using pattern matching.
    My patterns are from chick foot/feet.
    I'm  created multiple pattern matching VI's to detect all the feet because I find it difficult/impossible to match all the feet with a single pattern/template.
    However, when using multiple pattern matching VI's some pattern matches detect the same foot, hence overlapping.
    So how can I make the overlaping pattern matches to be counted as one?
    Thank you in advance

    Thank you for replying Sir Zwired1.
    I'm still a newbie in using LabVIEW so pardon me if I can't understand fully
    The objective of my project is to detect all the feet through pattern matching and count the pattern matches made.
    "Keep a 2D array of counts, initialized to zero and the same size as your array of possible locations, and increment the value every time you get a match. If multiple pattern matching attempts result in a match a given location in your count array might be "3" but all you care about is if the number is greater than zero."
    I'm sorry, but how do you do this? BTW, I'm using vision assistant.

  • Use of edge detection in pattern matching algorithm?

    Hello all,
                    I work for a group at Texas A&M University researching two-phase flow in reactors.  We have been using IMAQ Vision and had a question regarding the use of edge detection in the pattern matching algorithm.  I had seen the webcast entitled “Algorithms that Learn: The Sum and Substance of Pattern Matching and OCR” (http://zone.ni.com/wv/app/doc/p/id/wv-705) and in the webcast it was mentioned that the pattern matching algorithm uses edge detection to, (as best I can tell), reduce the candidate list further and to perform subpixel location calculations.  However, I was wondering if this edge detection process is still performed if we do not use the subpixel location calculation (i.e. if we uncheck the “Subpixel Accuracy” check box)?  Also, if edge detection is performed in the pattern matching algorithm is it consistent with the method described in Chapter 13 of the Vison Concepts Manual (“Geometric Matching”)?  Finally, if edge detection is performed in a manner consistent with Chapter 13 of the manual, how does the geometric matching correlation number affect the correlation calculation that was performed in the previous steps?  Are they simply multiplied together?
    Many thanks!
      -Aaron

    Jeff,
    We are using Imaq Vision Builder 4, with the included pattern matching that can be accessed via the menus (i.e. we haven't created a custom VI or anything.)  We are using the software to locate bubbles during boiling experiments and want a deeper understanding of what is going on "behind the scenes" of the algorithm, as we may have to explain how it works later.  We have been able to determine most of what we need from the webcast I had previously mentioned, except for the use of edge detection in the pattern matching algorithm.
    At the scales involved in our experiments, subpixel accuracy is really not needed and therefore we do not use it.  If edge detection is used in the pattern matching algorithm only to determine location with subpixel accuracy, then we do not really need to know how it works because we do not use that calculation.  Inversely, of course, if edge detection is used during pattern matching even without enabling subpixel accuracy, then we would like to have a fairly good understanding of the process.
    I've read most of the section on geometric matching in the Vision Concepts Manual and wondered if the process described there for edge detection (or feature matching) was also used in the basic pattern matching algorithm?
    To summarize, if edge detection is not used in the basic pattern matching algorithm without subpixel accuracy, then that is all I need to know.  If edge detection is used for pattern matching even without using the subpixel accuracy calculation, then we would like to learn more about how exactly it is used in the pattern matching algorithm.
    We would really appreciate any help you could give us... we've been digging around on the NI website for a couple of weeks now trying to fit together all the pieces of the pattern matching puzzle.
    Many thanks!
        Aaron

  • Pattern matching help

    Hi!
    I'm new to pattern matching and need a little code to get me started. I currently have it where the user enters a name and it compares that name to a string pulled from a file using String.indexOf(). If it does not match, it pulls the next name string from the file and trys again until it finds a match or reaches the end of the file.
    For example, if I enter "hn smith" it will match to "john smith" in the string pulled from the file.
    This works ok, but it would be a lot nicer if the user could enter in
    jo.n smith or jo* smith
    where it can match parts of the phrase instead of the exact phrase. I have done a slight bit of this in perl, but I am having a harder time in java.
    I would appreciate any help. Thank you!

    that's good when you know it, but when you are
    starting out it is nice to have an example to work
    with, one that is explained well, unlike many of the
    sites I have visited.http://java.sun.com/docs/books/tutorial/extra/regex/index.html
    The very first result from Google is a tutorial that explains regular expressions.

  • How do I do input pattern matching with the 6534?

    I am configuring the 6534 to have one 8 bit input port and one 8-bit output port. Both input and output are in continuous mode. The input port is scanning for a specific pattern, but doesn't need to save the data. When this specific pattern is received, the VB program must be notified so that it can perform some action. This will occur every 2 seconds, i.e. the input pattern will match every two seconds. How do I perform this continuous pattern match and how can I throw away the input data without overflowing the input buffer?

    It sounds like you want to do DAQ Event Messaging. With this mechanism, the driver actively notifies the user of a specific DAQ Event by either posting a message on a message queue or calling a callback function.
    There are several documents that describe how you can do this with Visual Basic. You can find some KnowledgeBase entries, and a really useful tutorial called "Using DAQ Event Messaging in Windows under Windows NT/95/3.1". You can find these by searching the http://www.ni.com/support pages for "daq event message", and then go on to choose Visual Basic, and Learning to use product features and functions.
    The feature that you are looking for is pattern matching, which is DAQ Event type 8 ? Digital Pattern Matched. When the document refers to the
    Config_DAQ_Event_Message, you can see the details of this function in the NI-DAQ Help file (Start menu >> Programs >> National Instruments >> NI-DAQ). As you will see in the tutorial, you use a different but analogous method. While you won't be using this particular function for Visual Basic, the description of those events may be helpful.
    Regards,
    Geneva L.
    Applications Engineer
    National Instruments
    http://www.ni.com/ask

  • IMAQ Pattern Match Score

    I am working on an application that uses the IMAQ Match Pattern VI.  The matches that are returned have a score assigned to them.  The help documentation for this reads:
    Score ranks the match results on a scale of 0 to 1,000, where 0 equals no match and 1,000 equals a perfect match.
    Likewise, there is a VI input called "Minimum Match Score", which is the smallest score a match can have to be considered valid. The data range for a match is between 0 and 1000. 
    Can anyone point me to a resource that might better explain how this score is derived or at least defined?  

    Hi,
    The NI Vision Concepts Manual provides ancillary information; I've linked that below. The In-Depth Discussion for both Pattern Matching and Geometric Matching may prove helpful in providing the detail you're wanting.
    Machine Vision:
    http://zone.ni.com/reference/en-XX/help/372916P-01​/TOC15.htm
    I hope you find this information helpful. Have a great day!
    - Kale

  • Pattern Matching or Golden Template

    Hello all,
       I posted a question earlier on what advice can be given for hardware that could be used to acquire a fingerprint. I got a very helpful answer. Now I'm still working on this fingerprint recognition project and have been looking around into the logic to be used on matching images. I came across both the "pattern matching" and "golden template" available features on NI Vision assistant and was hoping someone could point me on the right direction so that I could obtain more insight information on how either one of these features perform their matches.
    Thank you,
    OC
    Solved!
    Go to Solution.

    Hi OC,
    Included with NI Vision is the 400+ page Vision Concepts Manual.  This explains in detail all of the functions available in NI Vision, including Pattern Matching and Golden Template Comparison.
    This document can be found in <Program Files>\National Instruments\Vision\Documentation\Concepts_Manual.pdf
    Chris Bolin
    LabVIEW Partner Program, CLA

  • Java Pattern Matcher (Pattern.class bug? Stuck in Infinite Loop)

    Hi,
    I'm using the java pattern matcher and it appears to be stuck in an infinite loop and will not return from Pattern.class.
    It stays stuck in the following two code sequences...
    I'm using the following regex...
    java.util.regex.Matcher[pattern=[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|biz|info) region=0,353648 lastmatch=
    MAIN BLOCK STUCK IN LOOP:
    boolean study(TreeInfo info) {
    if (type != INDEPENDENT) {
    int minL = info.minLength;
    atom.study(info);
    info.minLength = minL;
    info.deterministic = false;
    return next.study(info);
    } else {
    atom.study(info);
    return next.study(info);
    SECOND BLOCK STUCK IN LOOP:
    boolean match(Matcher matcher, int i, CharSequence seq) {
    // Check for zero length group
    if (i > matcher.locals[beginIndex]) {
    int count = matcher.locals[countIndex];
    if (count < cmin) {
    matcher.locals[countIndex] = count + 1;
    boolean result = body.match(matcher, i, seq);
    // If match failed we must backtrack, so
    // the loop count should NOT be incremented
    if (!result)
    matcher.locals[countIndex] = count;
    return result;
    if (next.match(matcher, i, seq))
    return true;
    if (count < cmax) {
    matcher.locals[countIndex] = count + 1;
    boolean result = body.match(matcher, i, seq);
    // If match failed we must backtrack, so
    // the loop count should NOT be incremented
    if (!result)
    matcher.locals[countIndex] = count;
    return result;
    return false;
    return next.match(matcher, i, seq);
    Is this a bug with the Java 1.6 Pattern Matcher?
    Thanks
    V$h3r

    The Java Pattern Matcher is getting stuck in the following code...
    boolean study(TreeInfo info) {
    if (type != INDEPENDENT) {
    int minL = info.minLength;
    atom.study(info);
    info.minLength = minL;
    info.deterministic = false;
    return next.study(info);
    } else {
    atom.study(info);
    return next.study(info);
    boolean match(Matcher matcher, int i, CharSequence seq) {
    // Check for zero length group
    if (i > matcher.locals[beginIndex]) {
    int count = matcher.locals[countIndex];
    if (count < cmin) {
    matcher.locals[countIndex] = count 1;
    boolean result = body.match(matcher, i, seq);
    // If match failed we must backtrack, so
    // the loop count should NOT be incremented
    if (!result)
    matcher.locals[countIndex] = count;
    return result;
    if (next.match(matcher, i, seq))
    return true;
    if (count < cmax) {
    matcher.locals[countIndex] = count + 1;
    boolean result = body.match(matcher, i, seq);
    // If match failed we must backtrack, so
    // the loop count should NOT be incremented
    if (!result)
    matcher.locals[countIndex] = count;
    return result;
    return false;
    return next.match(matcher, i, seq);
    }Here is a copy of the REGEX that I'm using...
    It works on most of the other STRINGS but when I do a REGEX on the the html source for http://www.exponent.com it will get stuck...
    Pattern p = Pattern.compile("[a-zA-Z0-9+_~-]+(?:\\.[a-zA-Z0-9+_~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+(?:com|org|net|biz|info|[a-zA-Z]{2})");Thanks,
    V$h3r

  • How can I read a template and differentiate if it is a pattern matching template or a geometric matching template?

    Hey all,
    I would like to know how can I read a template´s information to know if it is a pattern macthing or a geometric matching template? 
    In my code, users provide templates and the algorithm must match them using pattern matching or geometric matching depending on the template.
    At the moment I am doing it by including a P or a G in the name of the file, but I would like to avoid this and read the information from the file.
    Any ideas?
    Thanks in advance,
    Esteban
    Solved!
    Go to Solution.

    Hey Esteban,
    you can use the VI "IMAQ Is Vision Info Present 2 VI" to reice the information:
    IMAQ Is Vision Info Present 2 VI - NI Vision 2011 for LabVIEW Help - National Instruments
    http://zone.ni.com/reference/en-XX/help/370281P-01/imaqvision/imaq_is_vision_info_present_2/
    Take a look at the attached VI
    Stephan
    Attachments:
    Determine Pattern type.zip ‏13 KB

  • Is there a way to turn the pattern matching example in Labview to instead of loading a rectangle around what you want the template to be you can use an image display , I've be trying and can get no where with it

    What I want to do is , have two images on image displays and the pass them through the same setup as the pattern matching example to get the number of matches , I have attached what I have done and also given the pattern matching example program as well.
    Hope to get answers back soon,
                                     Thanks Alan
    Attachments:
    screenshot.docx ‏48 KB
    Pattern Matching Example.vi ‏100 KB

    Hi there!
    The example used can be adapted for comparing two images, however the algorithm and coding for finding the differences is more specific to your actual problem. In terms of the loading and displaying of the images, this can be done in the same way.
    Once you have some sort of algorithm, then you can automate the learning and matching by simply wiring them in order. (in the example, these are put in case structures as they are waiting on response from the front panel)
    I hope that this helps,
    Liam A.
    National Instruments
    Applications Engineer

  • How to use AND,OR,NOT condition in Pattern Matching in java

    how to use AND,OR,NOT condition in Pattern Matching in java
    Please anyone give example..

    Stop asking these stupid vague questions and do some of your own research.
    Start here:
    http://www.regular-expressions.info/
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html

  • Regular expression and pattern matching/replacing

    I have a list of key words. It has around 1000 key word now but can grow to 5000 keywords.
    My web application displays lot of texts which are stored in the database. My requirement is to scan each text for the occurance of any of the above keywords. If any keyword is present I have to replace that with some custom values, before showing it to the user.
    I was thinking of using using regular expression for replacing the keyword in the text using matcher.replaceAll method as follows:
    Pattern pattern = Pattern.compile(patternStr);
    Matcher matcher = pattern.matcher(inputStr);
    String output = matcher.replaceAll(replacementStr);
    But My pattern string will have around 5000 keywords with the 'OR' Logical Operator like- keyword1| keyword2 I keyword3 | ..........
    Will such a big pattern string adversly affect the performance? What can I do to speed up the performance? (Since my keyword list is not static i would prefer to do the replacement just before showing the text to the user)
    Any suggestions are most welcome.

    I don't think a pure regex approach would be that slow, but it would be a maintenance nightmare. I think a combined regex/table-lookup approach would be best: use a regex to identify potential keywords, then look them up in the table to confirm. For instance, to find all Java keywords you could use the regex "\\b[a-z]{2,12}+\\b" to filter out anything that can't possibility be a keyword.
    What are you going to replace the keywords with? Will it vary depending on which keyword is found? If so, you'll have to use a table--and you won't be able to use the replaceAll method, because it can't handle dynamically generated replacement values. You would have to use the lower-level appendReplacement and appendTail method instead.

Maybe you are looking for

  • GPS maps issue

    Hello, I have a problem with the maps. I don't know what happened but yesterday when i opened the maps, i couldnt see the classic map but only the previously saved landmarks...and also nowhere appears the signal strengh bar...what happend..? 

  • How to pass pdf data to ABAP itab

    Hi, I have a pdf form that I want to upload in SAP and retrieve the data from the pdf and generate necessary transaction. I used the example in offline adobe form documentation: I've encountered 2 problems: 1. error message:  XSLT: No valid XML sourc

  • Problem recognizing new Ipod nano

    When I connect my new ipod nano to my mac and open itunes, the nano device is not recognized.  How do it get it to connect?

  • Need to Rewrite Distinct query...

    Hi All, Query A: SELECT count(DISTINCT FIELD_SERVICE_REP) CNT1   FROM SOP_SERVICE_REQUEST_JOB ssrj, sop_service_request ssr WHERE TO_DATE('06/12/2006', 'mm/dd/yyyy') BETWEEN        SSRJ.SCHEDULED_START_DATE AND SSRJ.SCHEDULED_END_DATE        AND fiel

  • Bluetooth on my MacBookPro shows "not available"

    Hi Guys bluetooth on my MacBookPro shows "not available"