Search Results

Search found 6715 results on 269 pages for 'preg match'.

Page 19/269 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Replacing Text which does not match a pattern in Oracle

    - by kutekrish
    I have below text in a CLOB in a table Table Name: tbl1 Columns col1 - number (Primary Key) col2 - clob (as below) Row#1 ----- Col1 = 1 Col2 = 1331882981,ab123456,Some text here which can run multiple lines and have a lot of text... ~1331890329,pqr123223,Some more text... Row#2 ----- Col1 = 2 Col2 = 1331882981,abc333,Some text here which can run multiple lines and have a lot of text... ~1331890329,pqrs23,Some more text... Now I need to know how we can get below output Col1 Value ---- --------------------- 1 1331882981,ab123456 1 1331890329,pqr123223 2 1331882981,abc333 2 1331890329,pqrs23 ([0-9]{10},[a-z 0-9]+.), == This is the regular expression to match "1331890329,pqrs23" and I need to know how can replace which are not matching this regex and then split them into multiple rows

    Read the article

  • Use jQuery to match variable text?

    - by VUELA
    Hello! I have a sidebar navigation that lists blog entry titles down the side of the page. I am trying to write some jquery that will check the text in the title of the current full blog entry page and match it with the corresponding title in the sidebar navigation so that I can apply a class to style for an active state link ... but I'm not quite getting it! Here is the link to an example page: http://ncw-commercial.com/property-listings/eastpoint-plaza-lot.html, and below is my current code. I have also tried using :contains but could not figure out how to get that to work with a variable rather than direct text. $('.single-journal-entry-wrapper .journal-entry .title').each(function(){ var activeTitle = $(this).text(); $(".feedburnerFeedBlock .headline a").filter(function(index) { return $(this).text() == "activeTitle"; }).parent().addClass("activeTitle"); });

    Read the article

  • Mercurial adding new file gives no match found error

    - by Ivo
    I have a strange problem with updating Mercurial. Everytime when I add a file to my repository and then update another location of the repository (for example with in CI process), the error "no match found" occures. Then when I remove to whole folder and clone it again there are no problems and the new added file(s) are there. Updating and removing doesnt give problems When I do "a" Verify the following is shown: data/test.txt.i@54: missing revlog! 54: empty or missing test.txt test.txt@54: b80de5d13875 in manifests not found 3 integrity errors encountered! (first damaged changeset appears to be 54) Any idea what could be causing this?

    Read the article

  • How to write a xpath to match all elements except a particular element

    - by Unmesh Kondolikar
    I am writing an XSL transformation. I want to write a template which matches all the child elements of the document except one particular node. My xml looks like this - <Document> <NodeA><\NodeA> <NodeB><\NodeB> <ServiceNode><\ServiceNode> <NodeX><\NodeX> </Document> I want to write a template that matches all nodes except ServiceNode i.e. NodeA to NodeX. How to write this Xpath to get - <xsl:template match="ALL Nodex Except ServiceNode">

    Read the article

  • Android WebView - cannot understand - Null or empty value for header "if-none-match"

    - by ganesh
    Hi When i tried to load a url i get an exception as below Uncaught handler: thread WebViewCoreThread exiting due to uncaught exception 06-16 10:22:31.471: ERROR/AndroidRuntime(635): java.lang.RuntimeException: Null or empty value for header "if-none-match" 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.net.http.Request.addHeader(Request.java:161) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.net.http.Request.addHeaders(Request.java:179) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.net.http.Request.<init>(Request.java:132) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.net.http.RequestQueue.queueRequest(RequestQueue.java:480) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.net.http.RequestHandle.createAndQueueNewRequest(RequestHandle.java:419) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.net.http.RequestHandle.setupRedirect(RequestHandle.java:195) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.webkit.LoadListener.doRedirect(LoadListener.java:1216) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.webkit.LoadListener.handleMessage(LoadListener.java:220) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.os.Handler.dispatchMessage(Handler.java:99) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.os.Looper.loop(Looper.java:123) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:471) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at java.lang.Thread.run(Thread.java:1060) the code i am using is webview = (WebView)findViewById(R.id.generalwebview); webview.getSettings().setJavaScriptEnabled(true); webview.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { Log.i("ReserveBooking", "Processing webview url click..."); view.loadUrl(url); return true; } public void onPageFinished(WebView view, String url) { Log.i("ReserveBooking", "Finished loading URL: " +url); } public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Log.e("ReserveBooking", "Error: " + description); Toast.makeText(ReserveBooking.this, description, Toast.LENGTH_SHORT).show(); } }); webview.loadUrl(utls); and when i changed the emulator, this programs works without any error .Please help me to know the reason why i get this error ,is this error somehow related to cache? ,I shall be glad if someone explains ganesh

    Read the article

  • Getting Oracle's MD5 to match PHP's MD5

    - by Zenshai
    Hi all, I'm trying to compare an MD5 checksum generated by PHP to one generated by Oracle 10g. However it seems I'm comparing apples to oranges. Here's what I did to test the comparison: //md5 tests //php md5 print md5('testingthemd5function'); print '<br/><br/>'; //oracle md5 $md5query = "select md5hash('testingthemd5function') from dual"; $stid = oci_parse($conn, $md5query); if (!$stid) { $e = oci_error($conn); print htmlentities($e['message']); exit; } $r = oci_execute($stid, OCI_DEFAULT); if (!$r) { $e = oci_error($stid); echo htmlentities($e['message']); exit; } $row = oci_fetch_row($stid); print $row[0]; The md5 function (seen in the query above) in Oracle uses the 'dbms_obfuscation_toolkit.md5' package(?) and is defined like this: CREATE OR REPLACE FUNCTION PORTAL.md5hash (v_input_string in varchar2) return varchar2 is v_checksum varchar2(20); begin v_checksum := dbms_obfuscation_toolkit.md5 (input_string => v_input_string); return v_checksum; end; What comes out on my PHP page is: 29dbb90ea99a397b946518c84f45e016 )Û¹©š9{”eÈOEà Can anyone help me in getting the two to match?

    Read the article

  • Two different assembly versions "The located assembly's manifest definition does not match the assem

    - by snicker
    I have a project that I am working on that requires the use of the Mysql Connector for NHibernate, (Mysql.Data.dll). I also want to reference another project (Migrator.NET) in the same project. The problem is even though Migrator.NET is built with the reference to MySql.Data with specific version = false, it still tries to reference the older version of MySql.Data that the library was built with instead of just using the version that is there.. and I get the exception listed in the title: ---- System.IO.FileLoadException : Could not load file or assembly 'MySql.Data, Version=1.0.10.1, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) The version I am referencing in the main assembly is 6.1.3.0. How do I get the two assemblies to cooperate? Edit: For those of you specifying Assembly Binding Redirection, I have set this up: <?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-6.1.3.0" newVersion="6.1.3.0"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration> I am referencing this the main assembly in another project and still getting the same errors. If my main assembly is copied local to be used in the other assembly, will it use the settings in app.config or does this information have to be included with every application or assembly that references my main assembly?

    Read the article

  • How to check and match the possible combinations of arraylist elements

    - by Jessy
    String [] A = {"High","Medium","Low"}; String [] B = {"High","Medium","Low"}; String [] C = {"High","Medium","Low"}; String [] D = {"High","Medium","Low"}; String [] E = {"High","Medium","Low"}; String [] F = {"High","Medium","Low"}; JComboBox Ai = new JComboBox(A); JComboBox Bi = new JComboBox(B); JComboBox Ci = new JComboBox(C); JComboBox Di = new JComboBox(C); JComboBox Ei = new JComboBox(E); JComboBox Fi = new JComboBox(F); .... //add the user choice in arrayList ArrayList<String> a = new ArrayList<String>(); a.add((String) Ai.getSelectedItem()); a.add((String) Bi.getSelectedItem()); a.add((String) Ci.getSelectedItem()); a.add((String) Di.getSelectedItem()); a.add((String) Ei.getSelectedItem()); a.add((String) Fi.getSelectedItem()); Scenario: On each comboBox, user need to choose one, which mean there are 6 choices at the end. There are 6*5*4*3*2*1 = 720 possible combinations of choices made by the user. What is the best way to check and match the user choice without writing the 720 else if ? e.g. if(Ai=="High" && Bi=="High" && Ci=="Low" && Di=="High" && Ei=="Low" && Fi=="Medium") { System.out.println("Good Choice"); } Thank you.

    Read the article

  • std::binary_function - no match for call?

    - by Venkat Shiva
    Hi, this is my code: #include <iostream> #include <functional> using namespace std; int main() { binary_function<double, double, double> operations[] = { plus<double>(), minus<double>(), multiplies<double>(), divides<double>() }; double a, b; int choice; cout << "Enter two numbers" << endl; cin >> a >> b; cout << "Enter opcode: 0-Add 1-Subtract 2-Multiply 3-Divide" << endl; cin >> choice; cout << operations[choice](a, b) << endl; } and the error I am getting is: Calcy.cpp: In function ‘int main()’: Calcy.cpp:17: error: no match for call to ‘(std::binary_function<double, double, double>) (double&, double&)’ Can anyone explain why I am getting this error and how to get rid of it?

    Read the article

  • Java 7u4 webstart security exception: Class does not match trust level

    - by Glstunna
    We began to notice that with Java 7 (particularly with update 4), that all our users began to see this with our Webstart app: [14:42:58,422] AWT-EventQueue-0(DEBUG) java.lang.SecurityException: class "CLASSNAME" does not match trust level of other classes in the same package [14:42:58,422] AWT-EventQueue-0(DEBUG) at com.sun.deploy.security.CPCallbackHandler$ChildElement.checkResource(Unknown Source) [14:42:58,422] AWT-EventQueue-0(DEBUG) at com.sun.deploy.security.DeployURLClassPath$JarLoader.checkResource(Unknown Source) [14:42:58,422] AWT-EventQueue-0(DEBUG) at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source) [14:42:58,422] AWT-EventQueue-0(DEBUG) at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source) [14:42:58,422] AWT-EventQueue-0(DEBUG) at java.net.URLClassLoader$1.run(Unknown Source) [14:42:58,422] AWT-EventQueue-0(DEBUG) at java.net.URLClassLoader$1.run(Unknown Source) [14:42:58,422] AWT-EventQueue-0(DEBUG) at java.security.AccessController.doPrivileged(Native Method) [14:42:58,422] AWT-EventQueue-0(DEBUG) at java.net.URLClassLoader.findClass(Unknown Source) [14:42:58,422] AWT-EventQueue-0(DEBUG) at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source) [14:42:58,422] AWT-EventQueue-0(DEBUG) at java.lang.ClassLoader.loadClass(Unknown Source) [14:42:58,422] AWT-EventQueue-0(DEBUG) at java.lang.ClassLoader.loadClass(Unknown Source)...More Where CLASSNAME = pretty much every class at random points from several jars in the app execution, breaking several behavior. If our users were to use Java 6, they have no problems! Just 7 (update 4). We sign ALL our jars, both the main application jar and it's library jars. i.e Users launching our webstart app see the blue shield instead of yellow or red. This is obviously an issue as users are more frequently now upgrading to Java 7. I have tried to force our app to use Java 6 on the user machine either by using a previous installation(works), or installing a new one....with the j2se version="1.6" tag around resources but this causes it's own problems that would probably be best to make into it's own thread (the auto-jre-installation part). Did Oracle break Webstart security with Java 7u4? How do I solve this securityexception issue?

    Read the article

  • VS2008 DataSet Wizard doesn't match tables for updating

    - by James H
    Hi all, first question ever on this site. I've been having a real stubborn problem using Visual Studio 2008 and I'm hoping someone has figured this out before. I have 2 libraries and 1 project that use strongly typed datasets (MSSQL backend) that I generated using the "Configure DataSet with Wizard" option on in Data Sources. I've had them working just fine for awhile and I've written a lot of code in the non-designer file for the row classes. I've also specified a lot of custom queries using the dataset designer. This is all work I can't afford to loose. I've recently made some changes to re-organize my libraries which included changing the names of the libraries themselves. I also changed the connection string to point to a different database which is a development copy (same exact schema). Problem is now when I open up "Configure DataSet with Wizard" to pickup a new column I've added to one of the tables it no longer matches the tables correctly in the wizard. The wizard displays all of the tables in the database and none of them have check boxes next to them (ie: are not part of this dataset). Below those it shows all of the tables again but with red Xs and these are checked. Basically meaning that Visual Studio sees all of the tables it currently has in the DataSet and sees all of the tables in the database, but believes they are no longer the same and thus do not match! I've had this same thing happen quite awhile back and I think I just re-built the xsd from scratch and manually copied the code over and then had to redefine all of the custom queries I built in the dataset designer. That's not a good solution. I'm looking for 2 answers: 1. What causes this to happen and how to prevent it. 2. How do I fix this so that the wizard once again believes the tables in its xsd are the same tables that are in the database (yes, they have the exact same names still). Thanks.

    Read the article

  • R:how to get grep to return the match, rather than the whole string

    - by Mike Dewar
    Hi, I have what is probably a really dumb grep in R question. Apologies, because this seems like it should be so easy - I'm obviously just missing something. I have a vector of strings, let's call it alice. Some of alice is printed out below: T.8EFF.SP.OT1.D5.VSVOVA#4 T.8EFF.SP.OT1.D6.LISOVA#1 T.8EFF.SP.OT1.D6.LISOVA#2 T.8EFF.SP.OT1.D6.LISOVA#3 T.8EFF.SP.OT1.D6.VSVOVA#4 T.8EFF.SP.OT1.D8.VSVOVA#3 T.8EFF.SP.OT1.D8.VSVOVA#4 T.8MEM.SP#1 T.8MEM.SP#3 T.8MEM.SP.OT1.D106.VSVOVA#2 T.8MEM.SP.OT1.D45.LISOVA#1 T.8MEM.SP.OT1.D45.LISOVA#3 I'd like grep to give me the number after the D that appears in some of these strings, conditional on the string containing "LIS" and an empty string or something otherwise. I was hoping that grep would return me the value of a capturing group rather than the whole string. Here's my R-flavoured regexp: pattern <- (?<=\\.D)([0-9]+)(?=.LIS) nothing too complicated. But in order to get what I'm after, rather than just using grep(pattern, alice, value = TRUE, perl = TRUE) I'm doing the following, which seems bad: reg.out <- regexpr( "(?<=\\.D)[0-9]+(?=.LIS)", alice, perl=TRUE ) substr(alice,reg.out,reg.out + attr(reg.out,"match.length")-1) Looking at it now it doesn't seem too ugly, but the amount of messing about it's taken to get this utterly trivial thing working has been embarrassing. Anyone any pointers about how to go about this properly? Bonus marks for pointing me to a webpage that explains the difference between whatever I access with $,@ and attr.

    Read the article

  • The OpenID Provider issued an assertion for an Identifier whose discovery information did not match

    - by Sohail
    I used sample code from DotNetOpenAuth.net to become my own OpenID Provider (OpenIDProviderWebForm) everything worked fine and I was able to test my OP against NerdDinner. now I want to customize the identifier like --- http://www.mydomain.com/user.aspx/Hash(Username+PrivateKey)~Username. everything works on OP side but on the NerdDinner application when the app tries to do HttpRequestInfo clientResponseInfo = new HttpRequestInfo("GET", auth, auth.PathAndQuery, headers, null); response = RelyingParty.GetResponse(clientResponseInfo); (you find these two lines of codes in AuthController.cs from NerdDinner) the response contains below error: The OpenID Provider issued an assertion for an Identifier whose discovery information did not match. Assertion endpoint info: ClaimedIdentifier: http://localhost:57571/user.aspx/76208371132EC7F7A37472C8B4CC2CC37A05B707~sohail ProviderLocalIdentifier: http://localhost:57571/user.aspx/76208371132EC7F7A37472C8B4CC2CC37A05B707~sohail ProviderEndpoint: http://localhost:57571/server.aspx OpenID version: 2.0 Service Type URIs: Discovered endpoint info: [ { ClaimedIdentifier: http://localhost:57571/user.aspx/EA467E35736AC22EB60C04C2E9D9594263B60ECB~sohail ProviderLocalIdentifier: http://localhost:57571/user.aspx/EA467E35736AC22EB60C04C2E9D9594263B60ECB~sohail ProviderEndpoint: http://localhost:57571/server.aspx OpenID version: 2.0 Service Type URIs: http://specs.openid.net/auth/2.0/signon http://openid.net/extensions/sreg/1.1 }, { ClaimedIdentifier: http://localhost:57571/user.aspx/EA467E35736AC22EB60C04C2E9D9594263B60ECB~sohail ProviderLocalIdentifier: http://localhost:57571/user.aspx/EA467E35736AC22EB60C04C2E9D9594263B60ECB~sohail ProviderEndpoint: http://localhost:57571/server.aspx OpenID version: 1.0 Service Type URIs: http://openid.net/signon/1.0 http://openid.net/extensions/sreg/1.1 }, ] anybody can help me please?

    Read the article

  • Regular expression to match HTML table row ( <tr> ) NOT containing a specific value

    - by user1821136
    I'm using Notepad++ to clean up a long and messy HTML table. I'm trying to use regular expressions even if I'm a total noob. :) I need to remove all the table rows that doesn't contain a specific value (may I call that substring?). After having all the file contents unwrapped, I've been able to use the following regular expression to select, one by one, every table row with all its contents: <tr>.+?</tr> How can I improve the regular expression in order to select and replace only table rows containing, somewhere inside a part of them, that defined substring? I don't know if this does matter but the structure of every table row is the following (I've put there every HTML tag, the dots stand for standard content/values) <tr> <td> ... </td> <td> ... </td> <td> <a sfref="..." href="...">!! SUBSTRING I HAVE TO MATCH HERE !!</a> </td> <td> <img /> </td> <td> ... </td> <td> ... </td> <td> ... </td> <td> ... </td> </tr> Thanks in advance for your help!

    Read the article

  • Zend hostname route doesn't match when it has child routes

    - by talisker
    I am implementing an Admin module, which contains the following routes: 'router' => array( 'routes' => array( 'admin' => array( 'type' => 'Zend\Mvc\Router\Http\Hostname', 'options' => array( 'route' => ':subdomain.mydomain.local', 'constraints' => array( 'subdomain' => 'admin', ), 'defaults' => array( 'module' => '__NAMESPACE__', 'controller' => 'Admin\Controller\Index', 'action' => 'index', ), ), 'priority' => 9000, 'may_terminate' => true, 'child_routes' => array( 'users' => array( 'type' => 'Zend\Mvc\Router\Http\Literal', 'options' => array( 'route' => '/users', 'defaults' => array( 'module' => '__NAMESPACE__', 'controller' => 'Admin\Controller\Users', 'action' => 'index', ), ), ), ) ), ), ), And this is the home route configuration: 'home' => array( 'type' => 'Zend\Mvc\Router\Http\Literal', 'options' => array( 'route' => '/', 'defaults' => array( 'controller' => 'Application\Controller\Index', 'action' => 'index', ), ), ), When I try to access to http://admin.mydomain.com, the route match always with the homeroute, but if I remove all the child routes from the admin route, the behavior is correct and a http://admin.mydomain.com matches with the adminroute. Any idea?

    Read the article

  • Scheme: Mysterious void in pattern match.

    - by Schemer
    Hi. I am writing a function called annotate that uses match-lambda -- often with recursive calls to annotate. Here is one of the pattern matches: (`(lambda (,<param1> . ,<params>) ,<stmts>) `(CLOSURE ENV (,<param1> . ,<params>) (lambda (ENV) ,(map annotate (map (lambda (x) (append `(,<param1> . ,<params>) (list x))) `(,<stmts>)))))) However, when this pattern is matched this is what returns: '(CLOSURE ENV (x) (lambda (ENV) ((CLOSURE ENV (x y) (lambda (ENV) ((+ x y)))))) #<void>) Specifically I can't figure out where "void" is coming from. In fact, if I include the line: ,(displayln (map annotate (map (lambda (x) (append `(,<param1> . ,<params>) (list x))) `(,<stmts>)))) it prints: ((CLOSURE ENV (x y) (lambda (ENV) ((+ x y))))) notably without "void". If someone could tell me what the problem is it would be greatly appreciated. Thanks.

    Read the article

  • Trying to match variables in a PHP array

    - by Nick B
    I'm stuck with a php array problem. I've to a webpage that takes values from a URL, and I need to cross reference those values against some values on the page and if they match output a 'yes'. It's an expression engine bodge job. The URL is something like domain.com/page/C12&C14 The C12 and C14 represent different categories. I've taken the last bit of the url, removed the 'C' from the values and then exploded the 12&14 into an array. I print_r the array on the page and it shows: Array ( [0] = 12 [1] = 14 ) So, the values are in the array. Lovely. Now on the page I have an html list which looks like 10 12 14 15 I want to output a YES next to the variables that are current in the array so the ideal output would be: 10 12 - YES 14 - YES 15 I was trying this but it keeps just saying No next to all of them. $currentnumber = 12; foreach ($tharray as $element) { if ($element == $currentnumber) { echo "Yes"; } else { echo "No"; } } I thought that should work, but it's not. I checked and the array and the variable are both stings. I did a strlen() on both to see if they are the same, but $currentnumber outputs '13' and the array variable outputs '2'. Any ideas as to why it's saying 13? Is the variable the wrong type of string - and if so how would I convert it?

    Read the article

  • Regular Expression doesn't match

    - by dododedodonl
    Hi All, I've got a regular expression in my cocoa-touch app (using RegexKitLite). NSString *week = [[NSString alloc] initWithFormat:@"%@", [pageContent stringByReplacingOccurrencesOfRegex:@"<select name=\"week\" class=\"selectbox\" style='width:134' onChange=\"doDisplayTimetable(NavBar, topDir);\">(.+?)<option value=\"(.+?)\">(.+?)</option>" withString:@"$2"]]; I expect it to match with the section of this (what is in NSString pageContent): <span class="selection"> <nobr> Periode<br> <span class="absatz"> &nbsp;<br> </span> <select name="week" class="selectbox" style='width:134' onChange="doDisplayTimetable(NavBar, topDir);"> <option value="14">17-5 - 16-7</option> </select> </nobr> </span> But it doesn't... I need the value of the option, it is possible that there is more than one (in that case I need them both separated by a ,. Can someone help me out? Regards, Dodo

    Read the article

  • String doesn't match regex when read from keyboard.

    - by athspk
    public static void main(String[] args) throws IOException { String str1 = "??123456"; System.out.println(str1+"-"+str1.matches("^\\p{InGreek}{2}\\d{6}")); //??123456-true BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str2 = br.readLine(); //??123456 same as str1. System.out.println(str2+"-"+str2.matches("^\\p{InGreek}{2}\\d{6}")); //?”??123456-false System.out.println(str1.equals(str2)); //false } The same String doesn't match regex when read from keyboard. What causes this problem, and how can we solve this? Thanks in advance. EDIT: I used System.console() for input and output. public static void main(String[] args) throws IOException { PrintWriter pr = System.console().writer(); String str1 = "??123456"; pr.println(str1+"-"+str1.matches("^\\p{InGreek}{2}\\d{6}")+"-"+str1.length()); String str2 = System.console().readLine(); pr.println(str2+"-"+str2.matches("^\\p{InGreek}{2}\\d{6}")+"-"+str2.length()); pr.println("str1.equals(str2)="+str1.equals(str2)); } Output: ??123456-true-8 ??123456 ??123456-true-8 str1.equals(str2)=true

    Read the article

  • Guru of the Week 2 no match for the operator==

    - by Adam
    From Guru of the Week 2. We have the function: string FindAddr(const list<Employee> l, string name) { for( list<Employee>::const_iterator i = l.begin(); i != l.end(); i++) { if( *i == name ) // here will be compilation error { return (*i).addr; } } return ""; } I added dummy Employee class to that: class Employee { string n; public: string addr; Employee(string name) : n(name) {} Employee() {} string name() const { return n; } operator string() { return n; } }; And got compilation error: error: no match for ‘operator==’ in ‘i.std::_List_iterator<_Tp>::operator* [with _Tp = Employee]() == name’ It works only if add operator== to Employee. But, Herb Sutter wrote that: The Employee class isn't shown, but for this to work it must either have a conversion to string or a conversion ctor taking a string. But Employee has a conversion function and conversion constructor as well. GCC version 4.4.3. Compiled normally, g++ file.cpp without any flags. There should be implicit conversion and it should work, why it doesn't?

    Read the article

  • Is there a faster method to match an arbitrary String to month name in Java

    - by jonc
    Hello, I want to determine if a string is the name of a month and I want to do it relatively quickly. The function that is currently stuck in my brain is something like: boolean isaMonth( String str ) { String[] months = DateFormatSymbols.getInstance().getMonths(); String[] shortMonths = DateFormatSymbols.getInstance().getShortMonths(); int i; for( i = 0; i<months.length(); ++i;) { if( months[i].equals(str) ) return true; if( shortMonths[i].equals(str ) return true; } return false; } However, I will be processing lots of text, passed one string at a time to this function, and most of the time I will be getting the worst case of going through the entire loop and returning false. I saw another question that talked about a Regex to match a month name and a year which could be adapted for this situation. Would the Regex be faster? Is there any other solution that might be faster?

    Read the article

  • MATLAB, time match filter

    - by Paul
    OK, I am still getting the hang of MATLAB. I have two files in different format. One Excel file. data1.xls, size= 86400 X 62. It looks like: Date/Time par1 par2 par3 par4 par5 par6 par6 par7 par8 par9 08/02/09 00:06:45 0 3 27 9.9 -133.2 0 0 0 1 0 Another file, data2.csv, size = 144 X 27. (If nothing is missing.) It looks like: date time P01 P02 P03 P04 P05 P06 P07 P08 P09 P10 P11 8/16/2009 0:00 51 45 46 54 53 52 524 5 399 89 78 Now I am using Data10minAvg = mean(reshape(Data,300,144,62)); to get the 10 min average of the first Excel file. Now I need to match up that file I am making above with the .csv file. The problem is many timestamps are missing in the .csv file. How do I make data2.csv into a file of size 144 X 27, replacing the missing datestamps by rows of zero? It will really help me than compare data1.xls file with newdata2.csv.

    Read the article

  • Finding the closest match

    - by doublescorpio
    I Have an object with a set of parameters like: var obj = new {Param1 = 100; Param2 = 212; Param3 = 311; param4 = 11; Param5 = 290;} On the other side i have a list of object: var obj1 = new {Param1 = 1221; Param2 = 212; Param3 = 311; param4 = 11; Param5 = 290;} var obj3 = new {Param1 = 35; Param2 = 11; Param3 = 319; param4 = 211; Param5 = 790;} var obj4 = new {Param1 = 126; Param2 = 218; Param3 = 2; param4 = 6; Param5 = 190;} var obj5 = new {Param1 = 213; Param2 = 121; Param3 = 61; param4 = 11; Param5 = 29;} var obj7 = new {Param1 = 161; Param2 = 21; Param3 = 71; param4 = 51; Param5 = 232;} var obj9 = new {Param1 = 891; Param2 = 58; Param3 = 311; param4 = 21; Param5 = 590;} var obj11 = new {Param1 = 61; Param2 = 212; Param3 = 843; param4 = 89; Param5 = 210;} What is the best (easiest) algorithm to find the closest match for the first obj in the listed objects?

    Read the article

  • In Perl, how to match several prefixes

    - by xorsyst
    I have 2 input files. One is a list of prefix and lengths, like this: 101xxx 102xxx 30xx 31xx (where x is any number) And another is a list of numbers. I want to iterate through the second file, matching each number against any of the prefix/lengths. This is fairly easy. I build a list of regexps: my @regexps = ('101...', '102...', '30..', '31..'); Then: foreach my $regexp (@regexps) { if (/$regexp/) { # do something But, as you can guess, this is slow for a long list. I could convert this to a single regexp: my $super_regexp = '101...|102...|30..|31..'; ...but, what I need is to know which regexp matched the item, and what the ..s matched. I tried this: my $catching_regexp = '(101)(...)|(102)(...)|(30)(..)|(31)(..)'; but then I don't know whether to look in $1, $3, %5 or $7. Any ideas? How can I match against any of these prefix/lengths and know which prefix, and what the remaining digits where?

    Read the article

  • replacing strings with regex in javascript

    - by koko
    Hi, regex is bugging me right now. I simply want to replace the range=100 in a string like var string = '...commonstringblabla&range=100&stringandsoon...'; with ...commonstringblabla&range=400&stringandsoon... I successfully matched the "range=100"-part with alert( string.match(/range=100/) ); But when I try to replace it string.replace(/range=100/, 'range=400'); nothing happens, the string still has the range=100 in it... I don't get it, please help.

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >