Searching Site Content Using REGEX Patterns

Intent: Detect content in SharePoint 2013 lists and libraries that matches a REGEX pattern, like social security numbers.
SharePoint 2013 only exposes KQL and FQL languages. 
http://msdn.microsoft.com/en-us/library/office/jj163973.aspx
I am comfortable writing this as an App.  I do not know how to pass the search index through a REGEX match.  Perhaps there is a way to access the data on more of a server model instead of through the client APIs?

Hi  Eric,
For achieving your demand, you can write a Content Enrichment Web Service to extract regex patterns from a managed property.
Here is a blog you can refer to:
SharePoint 2013 Content Enrichment: Regular Expression Data Extraction:
http://blogs.technet.com/b/peter_dempsey/archive/2013/12/04/sharepoint-2013-content-enrichment-regular-expression-data-extraction.aspx
Reference:
http://msdn.microsoft.com/en-us/library/office/jj163982.aspx
http://blogs.msdn.com/b/richard_dizeregas_blog/archive/2013/06/19/advanced-content-enrichment-in-sharepoint-2013-search.aspx
Thanks,
Eric
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
contact [email protected]
Eric Tao
TechNet Community Support

Similar Messages

  • Searching Private content using a Secure Portlet

    Hi all,
    Inside the Portal, i am using the HTML Portlet. Using the Iframe,
    <html>
    <IFRAME SRC="<host_name>:<port_number>/search/query/search?view=advanced" width="800" height="600">
    </IFRAME>
    </html>
    It's display fine. And i am key in the search term, the search result display a public contents only.
    AND
    I am register a Secure Portlet, then trying to search. It's also displays a public contents only.
    How will work on to search, a Private content as a corresponding PortalUser?
    (already we setup the SES to SSO).
    Note: A separate search (<host_name>:<port_number>/search/query/search) working fine to searching a private contents. But, inside the portlet it is not working.
    Can anyone help on this one? It is urgent now.
    Thanks in advance.

    Hi all,
    Please anyone help on this one.
    Thanks!

  • How to retrive latest items from different site collection using content search web part

    I have a web application that contains two site collections(team site + enterprise wiki), with the following URLs:-
    -http://applicationname/teamsite
    -http://applicationname/enterprisewik
    Now I need to display the latest 10 wiki pages that are inside the enterprise wiki site collection (according to the modified date) inside the team site. So I read that using Content search web part allows for cross-site content query.
    So I added a new content search web part , inside my team site, and I click on “change query” button. But I am not sure how I can reference the enterprise wiki site collection's library and to specify that I need to get the latest 10 wiki pages using the
    content search web part's query dialog box? Can anyone advice please ?
    Thanks

    Edit the webpart and click change query in search criteria.  click on switch to advanced mode and enter your path:
    (path:"http://applicationname/teamsite" OR path:"http://applicationname/enterprisewik")
    you can specify sorting by created date and click ok.  in number of items to show, type 10.  this should fulfill your requirement.
    For further reading, here are some links:
    http://office.microsoft.com/en-001/office365-sharepoint-online-enterprise-help/configure-a-content-search-web-part-in-sharepoint-HA104119042.aspx
    http://blogs.technet.com/b/tothesharepoint/archive/2013/04/30/stage-9-configure-the-
    query-in-a-content-search-web-part-on-a-category-page.aspx
    http://blogs.technet.com/b/tothesharepoint/archive/2013/05/23/stage-10-configure-the-query-in-a-content-search-web-part-on-a-catalog-item-page.aspx
    kashif

  • Search given string array and replace with another string array using Regex

    Hi All,
    I want to search the given string array and replace with another string array using regex in java
    for example,
    String news = "If you wish to search for any of these characters, they must be preceded by the character to be interpreted"
    String fromValue[] = {"you", "search", "for", "any"}
    String toValue[] = {"me", "dont search", "never", "trip"}
    so the string "you" needs to be converted to "me" i.e you --> me. Similarly
    you --> me
    search --> don't search
    for --> never
    any --> trip
    I want a SINGLE Regular Expression with search and replaces and returns a SINGLE String after replacing all.
    I don't like to iterate one by one and applying regex for each from and to value. Instead i want to iterate the array and form a SINGLE Regulare expression and use to replace the contents of the Entire String.
    One Single regular expression which matches the pattern and solve the issue.
    the output should be as:
    If me wish to don't search never trip etc...,
    Please help me to resolve this.
    Thanks In Advance,
    Kathir

    As stated, no, it can't be done. But that doesn't mean you have to make a separate pass over the input for each word you want to replace. You can employ a regex that matches any word, then use the lower-level Matcher methods to replace the word or not depending on what was matched. Here's an example: import java.util.*;
    import java.util.regex.*;
    public class Test
      static final List<String> oldWords =
          Arrays.asList("you", "search", "for", "any");
      static final List<String> newWords =
          Arrays.asList("me", "dont search", "never", "trip");
      public static void main(String[] args) throws Exception
        String str = "If you wish to search for any of these characters, "
            + "they must be preceded by the character to be interpreted";
        System.out.println(doReplace(str));
      public static String doReplace(String str)
        Pattern p = Pattern.compile("\\b\\w+\\b");
        Matcher m = p.matcher(str);
        StringBuffer sb = new StringBuffer();
        while (m.find())
          int pos = oldWords.indexOf(m.group());
          if (pos > -1)
            m.appendReplacement(sb, "");
            sb.append(newWords.get(pos));
        m.appendTail(sb);
        return sb.toString();
    } This is just a demonstration of the technique; a real-world solution would require a more complicated regex, and I would probably use a Map instead of the two Lists (or arrays).

  • Issue searching a content with a single quote in title using matches

    Hi,
    I'm trying to search a content which has a single quote in its title by using the following code:
    ISCSSearchAPI searchAPI = app.getUCPMAPI ().getActiveAPI ().getSearchAPI ();
    ISCSSearchQuery query = (ISCSSearchQuery)app.getUCPMAPI ().createObject (ISCSSearchQuery.class);
    query.setQueryText(queryText);
    ISCSSearchResponse response = searchAPI.search(scsContext, query);
    when the query text is: dDocTitle <matches> `What's New`
    an exception occurs:
    Unable to retrieve search results. Error occurred while retrying the search query. Error occurred while processing. Unable to return results.
    Exception in thread "main" com.stellent.cis.client.command.CommandException: Unable to retrieve search results. Error occurred while retrying the search query. Error occurred while processing. Unable to return results.
         at com.stellent.cis.server.api.scs.impl.SCSCommand.executeRequest(SCSCommand.java:338)
         at com.stellent.cis.server.api.scs.impl.SCSCommand.execute(SCSCommand.java:222)
         at com.stellent.cis.client.command.impl.services.CommandExecutorService.executeCommand(CommandExecutorService.java:57)
         at com.stellent.cis.client.command.impl.CommandFacade.executeCommand(CommandFacade.java:158)
         at com.stellent.cis.client.command.impl.BaseCommandAPI.invokeCommand(BaseCommandAPI.java:84)
         at com.stellent.cis.client.api.scs.search.impl.SCSSearchAPI.search(SCSSearchAPI.java:52)
         at com.guycarp.cm.service.ContentQueryService.search(ContentQueryService.java:133)
         at com.guycarp.cm.service.ContentQueryService.main(ContentQueryService.java:168)
    Caused by: com.stellent.cis.server.api.scs.request.SCSRequestException: Unable to retrieve search results. Error occurred while retrying the search query. Error occurred while processing. Unable to return results.
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestProcessor.checkBinderForErrors(SCSRequestProcessor.java:357)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestProcessor.validateResponse(SCSRequestProcessor.java:273)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestProcessor.processRequest(SCSRequestProcessor.java:118)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:61)
         at com.stellent.cis.server.api.scs.request.stream.SCSOptimizedPublishFilter.handleRequest(SCSOptimizedPublishFilter.java:128)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:58)
         at com.stellent.cis.server.api.scs.request.stream.SCSOptimizedRetrieveFilter.handleRequest(SCSOptimizedRetrieveFilter.java:250)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:58)
         at com.stellent.cis.server.api.scs.request.rewrite.SCSRewriteURLFilter.handleRequest(SCSRewriteURLFilter.java:140)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:58)
         at com.stellent.cis.server.api.scs.request.cache.impl.SCSServiceCacheFilter.handleRequest(SCSServiceCacheFilter.java:104)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestFilterChain.doRequestFilter(SCSRequestFilterChain.java:58)
         at com.stellent.cis.server.api.scs.request.impl.SCSRequestExecutorProxy.execute(SCSRequestExecutorProxy.java:105)
         at com.stellent.cis.server.api.scs.impl.SCSCommand.executeViaProxy(SCSCommand.java:353)
         at com.stellent.cis.server.api.scs.impl.SCSCommand.executeRequest(SCSCommand.java:335)
    but the query text dDocTitle <contains> `What's New`
    works fine.
    Is there any escape character that I should be using for the single quote when we use <matches> operator?
    Facing the same issue when searching from the content server console.
    Any idea!
    Thanks,
    Anil

    There seems to be none OOTB, but you can define it, see http://docs.oracle.com/cd/E25054_01/doc.1111/e10792/c05_search.htm#CHDIEECF

  • Using Site Content and Structure unable to move documents,pages and getting weird error message

    Hi ,
    earlier we are moving a page ,document from one site to another sub site with in the Site Collection.
    Now,we are getting a un-readable format error.
    After selecting the destination we are getting the error.
    and the file can't move.
    What might me be the error.
    Expecting answers related to my question.
    1.As we can do using Internet Explorer,
    2. Using Send To also we can move.
    Using this Site Content and structure we can maintain Versoining also.
    If any one face the same issue then we can easily find out the solution.
    Regards ,
    Prathap 
    SP Developer
    Specify the destination to move the items you selected.

    Hi,
    Using Site Content and Structure unable to move documents,pages and getting weird error message
    We are getting Below error:
    When Moving Document items from one site to another site in the same site collection using Site content and structure(But it's working in same site,we can move documents from one library to another library)
    1576|/wEWwwECuLLErw0Cy+nFYwK84baBAgK6zNqsAgLs0Le0BQK1s8uaCAL5qrm3CAKk7K6pDwKo9a0GArm+xr4NApKe9KUKAoajpK4CAqqU/2sChJXBtAIC052rYQKS+LTPAgLe+7uQAwLO0re/BwLgoaw2AojAlIMOApSO4JoNAuvW7MoKAojz2P4OAuOMt9EGAv/ns1wC64qI7gEC0LymmAcCro3lnQkCj7viwAsC8Met9QEC3a/DHALg4ZO6AQKAn8ebCALvr72DAwKm/NGmAgKN4aayCQLmmczsCgL+46qSAQKH7paCDgLouOHjDwKGuNCBCQKwuob2CQKP78n3BwLQ7vSYCALxlcvIBALRuajXAwK6/vr4AwKx8YasCQLti5igAQKay7JZAta625IFAuTy6rUKAvnC7eQKApvB3ugPAoTBua8BAoyajvgMAsGdloEJAvH+2KECAua7k9AGAv3Lzd8HAtPD3ocOAuX7hM4GAqO1g9sIAtn65sgFAuDkr9QEAt7I1KkMAryhltsIAtizx/kBAvzS7IcBAr+YhK4PAsO3rtADAvea+sADAsvc4IgKAp/1vIoMApelp3ICl+PqiwwC/KX1gwUC3fv58gIC7ZG/pwIC4cnupQgCq7mdlgYCjciR+AwC8/ue4gkC4YWJywUCs+rviAECpuyJigECkfr5rgkC08rHoQ0C+erayQUCjMqStQkCpIuKtwEC+dG5ngICoZ3/og0CspXoxwwC+pzgmwwCkoD5mAYCn/qH2AcC/N/pvAcCv5OtwAICuZquqgcC0/OFnwkC2/2wzQMCrJrO9woC69G52ggC64nunggCtLOIsQEC9LyC7gUC0ry/zgIC1ZDvgQ0C98OfMgL4kaj3CQKXhebCCwKi3bjPBQKYuojTCAKc4+fxCAKyjLfoBALVxO8SAsXSyuQLAqyvkNIPApDV5PgDAtufwJwEAu2BsoYLAs3Oqd8PAo6i+YMDAsy706oCAsLjx7kLApu3+9gKAuLnvMoIAtWywo8OAv6MjvIHAtSDhJwNArXRmL0LAraZvUcC5cGygQoCz5HN7A0C+YzY9AMCmtWQ6AUC/oHF8w4CxeTgmg8CgszujQECss22vgYCp6HBuggCkfm+FAKngqb5BgKkuIzAAQKPspKCCQLu+eDvCwKf5YrEBQKl0M3ACgKm85DvDALCu/nfCwLbwO38DgLoz5eyDQLfr9XLCwL20/eUDgL7hpr3DAKh1tfbCgL48OuNBwK4tuKaCALpgbn5CgLC4dKvBgKKlu76CwKfhKLJAQLurPTIAwLG0o+hAgKI5Y6dDALq+OOlCQKxjuuICAK8yrLHBwLcrOSSAwLoiJfQCwKKyvrtBALXkbCBCgKt4bG9BQLr6qnxCwLC2pz2DQKQ7OuZBALt7t+DDAKR47b8CAKi6pPGCQKLl4r3CQK5yfj+AwLgzYvjDwKUjerODQK7mOPTCQL9qP3qBgKYiOL9AgLA8pSaBwKay8fBDQLqw93DCgKkjpf/CwLsyquQCwKtpbGsDALMtKmxBwKPpvCmBOAFHtmBuG3iNmIT9fQ8Z1TWMpjZ122|cccccccccnncnnnnn|

  • How to Search document by using Long text description contents in SAPEasy DMS

    Hi,
    How to Search document by using Long text description contents in SAPEasy DMS
    Regards,
    Shrikant Shinde

    Hi Alfredo,
    Thanks for reply..Will you please explain in brief what are the  OCR program and workflow.
    Will you please send me any docs on [email protected]
    Thanks
    shiv.

  • Can we use WebCenter Sites content store in WebCenter Portal

    Hi,
    Can we use WebCenter Sites Content Store as the default content store in WebCenter Portal?
    I need to create website in WebCenter Sites, all the content will be stored in Sites Content Store. I also need to integrate WebCenter Portal with Sites content store to fetch contents from the store and display it in Portal. I do not wish to purchase WebCenter Content.
    Is this possible?
    Regards,
    Syed Rehan Shah

    Well , as suggested by jiri machotka, you can go for version 11.1.1.8.0 version with proper license.
    However,if you are using earlier versions than I must say that-
    It's going to be very very complex and cumbersome development process al-together . (at least for me) .Because why I am telling this is -
    The content repository structure of (webcenter site's CA server )is completely different from UCM (webcenter content server and preferred cms for portal).
    In previous threads ,lot of things are being discussed about this issue.
    In my opinion,you can very well integrate sites content to portal pages via REST API. Documentation is available.
    http://docs.oracle.com/cd/E29495_01/doc.1111/webcenter_sites_11gr1_wem_rest_api_resource_ref.pdf
    Apart from it, you can also do -
    1. Gadgets - You can consume Gadgets from WebCenter Portal, some examples with Google Gadgets are available in OTN.
    2. Widgets - You can build HMTL + Javascript widgets with Sites and embed in WebCenter Portal pages.
    Hope this info helps you out.
    Regards,
    Hoque

  • Is it possible to have multiple search results page using one Search Enterprise Center site?

    Hi,
    We're using SharePoint 2013 and I'm trying to modify the search results page for one site collection. By default, it uses the search results page from the parent site which is the search center being used by default for the web application. I need to make
    sure that the site collection will only retrieve search results within the site collection (search everything has to be disabled). I found a way but I had to create another search center site to accomplish this, otherwise, it will affect the search center
    site of all other site collections on the web app.
    Now is it possible to have multiple search results page using one Search Enterprise Center site?

    Hi,
    According to your description, you want to retrieve the search results within the site collection.
    As a workaround, you can create a custom result source for the site collection and you will retrieve the search result within the site collection.
    More information about how to create result source in SharePoint 2013, please refer to :
    http://technet.microsoft.com/en-us/library/jj683115(v=office.15).aspx
    http://techmikael.blogspot.com/2013/04/limiting-search-results-in-sharepoint.html
    Best regards

  • When i use Firefox and do a Google search, find what i need and click on the link I keep getting automatically redirected to another search site

    When i use Firefox and do a Google search, find what i need and click on the link I keep getting automatically redirected to another search site called http://www.scour.com
    Can someone tell me if this is a problem with Google or Mozilla? or both? or neither?

    This type of behaviour can be caused by malware. Try running several malware scanners. It is best to run several as each will pick up things that the others miss. Some scanners you can try are:
    * [http://www.malwarebytes.org/mbam.php Malwarebytes]
    * [http://www.superantispyware.com/ SUPERAntiSpyware]
    * [http://www.lavasoft.com/products/ad_aware_free.php Ad-Aware]
    * [http://www.microsoft.com/windows/products/winfamily/defender/default.mspx Windows Defender]
    * [http://www.safer-networking.org/en/home/index.html Spybot S&D]
    This link may help - http://deletemalware.blogspot.com/2010/02/remove-google-redirect-virus.html
    If the above malware scanners do not find any malware or can not clear it, you should consider posting in one of these forums for specialized malware removal help:
    * http://forums.spybot.info/
    * http://www.spywarewarrior.com/index.php
    * http://forum.aumha.org/
    * http://www.bleepingcomputer.com/forums/
    * http://www.spywareinfoforum.com/

  • Moving pages using Manage Site content and structure is corrupting the version history

    Hi,
    I am using share point 2010 manage site content and structure feature to move pages from one sub site to other. After doing several edits and check ins of a page and if I try to move the page using manage site content and structure , the version history
    is corrupted in the destination site (i.e., all the versions are not showing).
    Note: Sometimes content is also getting replicated after performing move operation.
    Is it a Bug/ Known issue in SharePoint?
    Any info on this issue is very helpful to us.
    Thanks in advance!!

    Hi,
    Using Site Content and Structure unable to move documents,pages and getting weird error message
    We are getting Below error:
    When Moving Document items from one site to another site in the same site collection using Site content and structure(But it's working in same site,we can move documents from one library to another library)
    1576|/wEWwwECuLLErw0Cy+nFYwK84baBAgK6zNqsAgLs0Le0BQK1s8uaCAL5qrm3CAKk7K6pDwKo9a0GArm+xr4NApKe9KUKAoajpK4CAqqU/2sChJXBtAIC052rYQKS+LTPAgLe+7uQAwLO0re/BwLgoaw2AojAlIMOApSO4JoNAuvW7MoKAojz2P4OAuOMt9EGAv/ns1wC64qI7gEC0LymmAcCro3lnQkCj7viwAsC8Met9QEC3a/DHALg4ZO6AQKAn8ebCALvr72DAwKm/NGmAgKN4aayCQLmmczsCgL+46qSAQKH7paCDgLouOHjDwKGuNCBCQKwuob2CQKP78n3BwLQ7vSYCALxlcvIBALRuajXAwK6/vr4AwKx8YasCQLti5igAQKay7JZAta625IFAuTy6rUKAvnC7eQKApvB3ugPAoTBua8BAoyajvgMAsGdloEJAvH+2KECAua7k9AGAv3Lzd8HAtPD3ocOAuX7hM4GAqO1g9sIAtn65sgFAuDkr9QEAt7I1KkMAryhltsIAtizx/kBAvzS7IcBAr+YhK4PAsO3rtADAvea+sADAsvc4IgKAp/1vIoMApelp3ICl+PqiwwC/KX1gwUC3fv58gIC7ZG/pwIC4cnupQgCq7mdlgYCjciR+AwC8/ue4gkC4YWJywUCs+rviAECpuyJigECkfr5rgkC08rHoQ0C+erayQUCjMqStQkCpIuKtwEC+dG5ngICoZ3/og0CspXoxwwC+pzgmwwCkoD5mAYCn/qH2AcC/N/pvAcCv5OtwAICuZquqgcC0/OFnwkC2/2wzQMCrJrO9woC69G52ggC64nunggCtLOIsQEC9LyC7gUC0ry/zgIC1ZDvgQ0C98OfMgL4kaj3CQKXhebCCwKi3bjPBQKYuojTCAKc4+fxCAKyjLfoBALVxO8SAsXSyuQLAqyvkNIPApDV5PgDAtufwJwEAu2BsoYLAs3Oqd8PAo6i+YMDAsy706oCAsLjx7kLApu3+9gKAuLnvMoIAtWywo8OAv6MjvIHAtSDhJwNArXRmL0LAraZvUcC5cGygQoCz5HN7A0C+YzY9AMCmtWQ6AUC/oHF8w4CxeTgmg8CgszujQECss22vgYCp6HBuggCkfm+FAKngqb5BgKkuIzAAQKPspKCCQLu+eDvCwKf5YrEBQKl0M3ACgKm85DvDALCu/nfCwLbwO38DgLoz5eyDQLfr9XLCwL20/eUDgL7hpr3DAKh1tfbCgL48OuNBwK4tuKaCALpgbn5CgLC4dKvBgKKlu76CwKfhKLJAQLurPTIAwLG0o+hAgKI5Y6dDALq+OOlCQKxjuuICAK8yrLHBwLcrOSSAwLoiJfQCwKKyvrtBALXkbCBCgKt4bG9BQLr6qnxCwLC2pz2DQKQ7OuZBALt7t+DDAKR47b8CAKi6pPGCQKLl4r3CQK5yfj+AwLgzYvjDwKUjerODQK7mOPTCQL9qP3qBgKYiOL9AgLA8pSaBwKay8fBDQLqw93DCgKkjpf/CwLsyquQCwKtpbGsDALMtKmxBwKPpvCmBOAFHtmBuG3iNmIT9fQ8Z1TWMpjZ122|cccccccccnncnnnnn|

  • Sharepoint Cross-Site Content Rollup using Sharepoint Designer with Different Sites deployed in different ports

    Hi
    In Sharepoint Designer Cross Site Content Rollup is achieved using SOAP service in different site collections in Same domain (Same Port where site is deployed). Please provide the information that different sites in different
    ports.
    For Eg: Site A in one port (1000) and Site B in Another Port(2000). I want to access it from site A SP List in Site B using Sharepoint designer.

    HI Krupesh,
    You can call the web service or REST API to update the item in List B and List C in workflow.
    Below mentioned links help in calling web service activity in workflow:
    http://msdn.microsoft.com/en-us/library/office/dn567558%28v=office.15%29.aspx
    http://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/
    Best Regards,
    Brij K

  • When using google I am transferred to other web search sites and not the sites I am clicking on.

    While using Google I am being connected to other search sites and not the sites I am clicking to go to.
    == URL of affected sites ==
    http://

    It has nothing to do with Firefox -- it sounds like the sites you're trying to go to are already taken down. If that's the case, try clicking the Google's results' "Cached" button, or just try the other results Google gave you.

  • Email address validation, is there a way to use Regex or other fuzzy searching?

    I would like to use PL/SQL for Email address validation, is there a way to use Regex (regular expressions) or some other fuzzy searching for that? Using % and _ wildcards only take you so far...
    I need something that will verify alphanumeric charectors (no ",'.:#@&*^ etc.) any ideas?
    Current code:
    if email not like '_%@_%.__%' or email like '%@%@%' or email like '% %' or email like '%"%' or email like '%''%' or email like '%
    %' then
    The last line is to make sure there are no linebreaks in the middle of the email address, is there a better way to signify a line break, like \n or an ascii equivilent?

    Michael:
    The as noted in the previous post, DBI is a Perl package that allows Perl to talk to various databases, including Oracle. We use DBI on several UNIX servers, and it does not require ODBC, and I have always found it to be extremely quick. Things may be different in the Windows world.
    If you are spooling files out to run through Perl anyway, you may want to take a look at DBI. You could probably modify your existing scripts to use DBI fairly easily. The basic structure using DBI is like:
    use DBI;
    my dbh;       # A database handle
    my sth;       # A statment handle
    my sqlstr;    # SQL statement
    my db_vars;   # Variables for your db columns
    # Connect to the database
    $dbh = DBI->connect( "dbi:Oracle:service_name","user/password");
    $sqlstr = 'SELECT * FROM emp WHERE id = ?' # even takes bind variables
    #Prepare statement
    $sth = $dbh->prepare($sqlstr);
    $sth->execute(12345);  # Execute with values for bind if desired
    # Walk the "cursor"
    while (($db_vars) = $sth->fetchrow_array()) {
       your processing here

  • Regex Pattern Match in an extremely long string

    I need to search a file containing 1 extremely long line (approximately 1 million characters), The pattern I want to search is "ABC" as long as it appears at least n times whatever user input as n. I need the position of where this pattern is found. How to best do this? I tried to break the input into blocks of 100000 characters at a time as too many characters read cause the 'java out of memory' error to occur.
    Then I converted this to a string in order to use REGEX to search. My problem is how to ensure that the last few characters of the current block is also being searched too? How to write the regex expression to do this? Will breaking the input file into multiple lines help?
    eg:
    Searching for ABC as long as it appears at least 3 times continuously ie (ABCABCABC)
    Original Line = XXXXXXXABCABCABCXXXXXXABCX
    The first block of 10 characters read is XXXXXXXABCABC
    The second block of 10 characters read is ABCXXXXXXABCX
    The search result should be position 7 and position 22

    If the sequence of characters is longer than a few hundred KB, then turning it into a String requires you to have enough heap space available in the JVM to store the entire String.
    If that is a problem, an alternative solution is to have a while loop over an InputStream that reads from the source of characters (a file, a network connection, stdin etc.) and looks for the string. Keep a ring buffer the size of the query string, and read the data from the InputStream into it. Then for each character read, compare the content of the ring buffer to the query string.
    This way you will not use more heap space than the size of the query-string, and the size of whatever buffer you use in your InputStream (8KB for the empty constructor of BufferedInputStream at the moment) plus the odds'n ends from the implementation.

Maybe you are looking for

  • Load Balancing on RAC Test

    Hi Team, We have 2 node ORACLE 10g RAC setup on RHEL4 We have to prepare a Load Balancing Scenario 1. How and on what basis Client Requests/load balancing are done on the oracle 10g RAC nodes 2. How to Moniotor on which node client request/tasks are

  • Mapping conversion of source value 4448601.75 to target value 448601

    Mapping conversion of source value 4448601.75 to target value 4448601 or source value 999999.99 to target value 999999 Here standard functions like round, floor, ceil..etc, will not work because they will convert source value 4448601.75 to 4448602 an

  • Removing Ken Burns effect once photo is on time line

    I am using the lastest version of iMovie, I have made a movie using only photos. All of the photos have the Ken Burn's effect some are ok but other are not. Can the Ken Burn's effect be turned off once images are on the time line?

  • Skype status is always available on windows, even ...

    skype status is always available on windows, even after logging out. how to fix that?

  • Siebel Install Help

    I am from the Oracle CRM world. Want to install Siebel Call Center (Sample Database) on a Windows XP Home machine. This is just to poke around and see how different it is from Oracle. 1. Can Siebel be installed on Windows XP Home? if so what are the