Search Results

Search found 5493 results on 220 pages for 'boost regex'.

Page 12/220 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • test filenames for regex patterns in bash

    - by rk
    I'm not sure exactly how the code should be written but I want to test a file/folder for naming patterns, something like: if [ -d $i ] && [ regex([0-9].,$i) { do something } I want it to check if the file/folder is a directory and that the name of it is a number (i.e. 1 or 101 or 10007)...

    Read the article

  • Regex in Notepad++ 6

    - by Rocket
    So, Notepad++ got updated to v6.0. One of their new features is PCRE (Perl Compatible Regular Expressions). I tried to use this new feature to find and replace things in a file. I tried the regular expression: {\$([a-zA-Z_]*)} and it yelled at me, saying "Invalid regular expression". I tested this regex in other programs (like my main IDE, Geany), and it worked fine. Why does this not work in Notepad++ 6.0?

    Read the article

  • Regex split string but keep separators

    - by rwwilden
    I'd like to do a Regex.Split on some separators but I'd like to keep the separators. To give an example of what I'm trying: "abc[s1]def[s2][s3]ghi" --> "abc", "[s1]", "def", "[s2]", "[s3]", "ghi" The regular expression I've come up with is new Regex("\\[|\\]|\\]\\["). However, this gives me the following: "abc[s1]def[s2][s3]ghi" --> "abc", "s1", "def", "s2", "", "s3", "ghi" The separators have disappeared (which makes sense given my regex). Is there a way to write the regex so that the separators themselves are preserved?

    Read the article

  • Regex to validate JSON

    - by Shard
    I am looking for a Regex that allows me to validate json. I am very new to Regex's and i know enough that parsing with Regex is bad but can it be used to validate?

    Read the article

  • boost.test and eclipse

    - by Anton Potapov
    Hi all, I'm using Eclipse CDT and Boost.Test(with Boost.Build). I would like Eclipse to parse output of Boost.Test generated during by run of test suites during build. Does anybody know how to achieve this? Thanks in advance

    Read the article

  • Very simple regex not working

    - by Thomas Wanner
    I have read that to match a word inside of a string using Regular expressions (in .NET), I can use the word boundary specifier (\b) within the regex. However, none of these calls result in any matches Regex.Match("INSERT INTO TEST(Col1,Col2) VALUES(@p1,@p2)", "\b@p1\b"); Regex.Match("INSERT INTO TEST(Col1,Col2) VALUES(@p1,@p2)", "\bINSERT\b"); Is there anything I am doing wrong ?

    Read the article

  • Regex.Replace only replaces start of string

    - by Yannick Smits
    I'm trying to replace a friendly url pattern with a html url notation but due to lack of regex experience I can't figure out why my regex only replaces the first occurence of my pattern: string text = "[Hotel Des Terrasses \http://flash-hotel.fr/] and [Du Phare \http://www.activehotels.com/hotel/]"; text = Regex.Replace(text, @"\[(.+)\s*\\(.+)\]", "<a href=\"$2\" target=\"_blank\">$1</a>"); How can i make the second pattern be replaced with the HTML markup too?

    Read the article

  • Case insensitive Regex without using RegexOptions enumeration

    - by spoon16
    Is it possible to do a case insensitive match in C# using the Regex class without setting the RegexOptions.IgnoreCase flag? What I would like to be able to do is within the regex itself define whether or not I want the match operation to be done in a case insensitive manner. I would like this regex, taylor, to match on the following values: Taylor taylor taYloR

    Read the article

  • Regex, encoding, and characters that look a like

    - by hack.augusto
    First, a brief example, let's say I have this "/[0-9]{2}°/" regex and this text "24º". The text won't match, obviusly ... (?) really, it depends on the character encoding. Here is my problem, I do not have control on which chars the user uses, so, I need to cover all possibilities in the regex /[0-9]{2}[°º]/, or even better, assure that the text has only the chars I'm expecting °. But I can't just remove the unknow chars otherwise the regex won't work, I need to change it to the chars that looks like it and I'm expecting. I have done this through a little function that maps the "look like" to "what I expect" and change it, the problem is, I have not covered all possibilities, for example, today I found a new "-", now we got three of them, just like latex =D - -- --- ,cool , but the regex didn't work. Does anyone knows how I might solve this?

    Read the article

  • Use regex in awk command in bash script

    - by fmpdmb
    I'm trying to read a file of regexes, looping over them and filtering them out of another file. I'm so close, but I'm having issues with my $regex var substitution I believe. while read regex do awk -vRS= '!/$regex/' ORS="\n\n" $tempOne > $tempTwo mv $tempTwo $tempOne done < $filterFile $tempOne and $tempTwo are temporary files. $filterFile is the file containing the regexes.

    Read the article

  • URL regex search and replace on MySQL (in WordPress)

    - by Tal Galili
    Hello all, I have a WordPress blog with numerous URL's I wish to replace from this: http://www.oldwebsite.co.il/name/*.asp To this: http://www.newwebsite.com/?p=* For example, from this: http://oldwebsite.co.il/name/65971.asp To this: http://www.newwebsite.com/?p=65971 I believe the following plugin: http://urbangiraffe.com/plugins/search-regex/ will do the trick with regex, but I am looking for the correct regex to use here. I found this stackoverflow thread that has a similar task, but since I am not too apt with regex, I was hoping for help so I don't mess anything up. Thanks, Tal After searching stackoverflow, I found

    Read the article

  • Regex expresion in MS SQL

    - by adopilot
    I do not not know much about Regex, I want to try parsing sting from database according to flowing instructions. I know that I am need to use CLR but for begin I want to learn Regex Data in tables look like create table #tempTBL (opis varchar(40)) go insert into #tempTBL select 'C 136' union select 'C 145' union select 'C146' union select 'AK C 182' union select 'C 277' union select 'C-240' union select 'ISPRAVKA PO C 241' And select sting looks like Select reverse( rtrim( ltrim( replace( (substring (reverse(opis) ,0 ,charindex( 'C',reverse(opis) ) ) ) ,'-',' ') ) ) ) as jci from #tempTBL How should looks like my C# code to I repeat this using regex

    Read the article

  • [C++] Write connected components of a graph using Boost Graph

    - by conradlee
    I have an file that is a long list of weighted edges, in the following form node1_id node2_id weight node1_id node3_id weight and so on. So one weighted edge per line. I want to load this file into boost graph and find the connected components in the graph. Each of these connected components is a subgraph. For each of these component subgraphs, I want to write the edges in the above-described format. I want to do all this using boost graph. This problem is in principle simple, it's just I'm not sure how to implement it neatly because I don't know my way around Boost Graph. I have already spent some hours and have code that will find the connected components, but my version is surely much longer and more complicated that necessary---I'm hoping there's a boost-graph ninja out there that can show me the right, easy way.

    Read the article

  • LookAhead Regex in .Net - unexpected result

    - by AaronM
    Hello, I am a bit puzzled with my Regex results (and still trying to get my head around the syntax). I have been using http://regexpal.com/ to test out my expression, and its works as intended there, however in C# its not as expected. Here is a test - an expression of the following: (?=<open>).*?(?=</open>) on an input string of: <open>Text 1 </open>Text 2 <open>Text 3 </open>Text 4 <open>Text 5 </open> I would expect a result back of <open>Text1 <open>Text 2 <open>Text 3... etc However when I do this in C# it only returns the first match of <open>Text1 How do I get all five 'results' back from the Regex? Regex exx = new Regex("(?=<open>).*?(?=</open>)", RegexOptions.IgnoreCase | RegexOptions.Singleline); string input = "<open>Text 1</open> Text 2 <open> Text 3 </open> Text 4 <open> Text 5 </open>"; string result = Regex.Match(input, exx.ToString(), exx.Options).ToString();

    Read the article

  • Perl : get substring which matches regex error

    - by Michael Mao
    I am very new to Perl, so please bear with my simple question: Here is the sample output: Most successful agents in the Emarket climate are (in order of success): 1. agent10896761 ($-8008) 2. flightsandroomsonly ($-10102) 3. agent10479475hv ($-10663) Most successful agents in the Emarket climate are (in order of success): 1. agent10896761 ($-7142) 2. agent10479475hv ($-8982) 3. flightsandroomsonly ($-9124) I am interested only in agent names as well as their corresponding balances, so I am hoping to get the following output: agent10896761 -8008 flightsandroomsonly -10102 agent10479475hv -10663 agent10896761 -7142 agent10479475hv -8982 flightsandroomsonly -9124 For later processes. This is the code I've got so far: #!/usr/bin/perl -w open(MYINPUTFILE, $ARGV[0]); while(<MYINPUTFILE>) { my($line) = $_; chomp($line); # regex match test if($line =~ m/agent10479475/) { if($line =~ m/($-[0-9]+)/) { print "$1\n"; } } if($line =~ m/flightsandroomsonly/) { print "$line\n"; } } The second regex match has nothing wrong, 'cause that is printing out the whole line. However, for the first regex match, I've got some other output such like: $ ./compareResults.pl 3.txt 2. flightsandroomsonly ($-10102) 0479475 0479475 3. flightsandroomsonly ($-9124) 1. flightsandroomsonly ($-8053) 0479475 1. flightsandroomsonly ($-6126) 0479475 If I "escape" the braces like this if($line =~ m/\($-[0-9]+\)/) { print "$1\n"; } Then there is never a match for the first regex... So I'm stuck with a problem of making that particular regex work. Any hints for this? Many thanks in advance.

    Read the article

  • regex matches with intersection in C#

    - by StuffHappens
    Hello. I wonder if it is possible to get MatchCollection with all matches even if there's intersection among them. string input = "a a a"; Regex regex = new Regex("a a"); MatchCollection matches = regex.Matches(input); Console.WriteLine(matches.Count); This code return 1, but I want it to return 2. How do achive it? Thank you for your help.

    Read the article

  • Regex pattern failing

    - by Scott Chamberlain
    I am trying to strip out all things that are in a string that are not a letter number or space so I created the regex private static Regex _NonAlphaChars = new Regex("[^[A-Za-z0-9 ]]", RegexOptions.Compiled); however When I call _NonAlphaChars.Replace("Scott,", ""); it returns "Scott," What am I doing wrong that it is not matching the ,?

    Read the article

  • Generating a list of values a regex COULD match in Python

    - by mlissner
    I'm trying to use a regex as an input, and from there generate all the possible values that the regex would match. So, for example, if the regex is "three-letter words starting with a, and ending in c," then the code would generate a list with the values [aac, abc, acc, adc, a1c....]. Is there an easy way to do this? I'm using python.

    Read the article

  • Mocking using boost::shared_ptr and AMOP

    - by Edison Gustavo Muenz
    Hi, I'm trying to write mocks using amop. I'm using Visual Studio 2008. I have this interface class: struct Interface { virtual void Activate() = 0; }; and this other class which receives pointers to this Interface, like this: struct UserOfInterface { void execute(Interface* iface) { iface->Activate(); } }; So I try to write some testing code like this: amop::TMockObject<Interface> mock; mock.Method(&Interface::Activate).Count(1); UserOfInterface user; user.execute((Interface*)mock); mock.Verifiy(); It works! So far so good, but what I really want is a boost::shared_ptr in the execute() method, so I write this: struct UserOfInterface { void execute(boost::shared_ptr<Interface> iface) { iface->Activate(); } }; How should the test code be now? I tried some things, like: amop::TMockObject<Interface> mock; mock.Method(&Interface::Activate).Count(1); UserOfInterface user; boost::shared_ptr<Interface> mockAsPtr((Interface*)mock); user.execute(mockAsPtr); mock.Verifiy(); It compiles, but obviously crashes, since at the end of the scope the variable 'mock' gets double destroyed (because of the stack variable 'mock' and the shared_ptr). I also tried to create the 'mock' variable on the heap: amop::TMockObject<Interface>* mock(new amop::TMockObject<Interface>); mock->Method(&Interface::Activate).Count(1); UserOfInterface user; boost::shared_ptr<Interface> mockAsPtr((Interface*)*mock); user.execute(mockAsPtr); mock->Verifiy(); But it doesn't work, somehow it enters an infinite loop, before I had a problem with boost not finding the destructor for the mocked object when the shared_ptr tried to delete the object. Has anyone used amop with boost::shared_ptr successfully?

    Read the article

  • regex substring C#

    - by sharma
    Hi, I need help to figure the regex expression I have string = "STATE changed from [Fixed] to [Closed], CLOSED DATE added [Fri Jan 14 09:32:19 MST 2011], NOTES changed from [CLOSED[]<br />] to [TEST CLOSED <br />]" I need to grab NOTES changed from [CLOSED[]<br />] to [TEST CLOSED <br />] and take values CLOSED[] and TEST CLOSED in two string variables. So far I got to: Regex NotesChanged = new Regex(@"NOTES changed from \[(\w*|\W*)\] to \[([\w-|\W-]*)\]"); which matches only if "NOTES changed from" started at the beginning and has no '[]' within '[ ]', but I have "[CLOSED[]]" and also no "". Any ideas on what to change in regex. Thanks, Sharma

    Read the article

  • Eclipse c++ with mingw comiler cant build boost regex example, can find .a library files

    - by Kim
    Hi, I'm trying to build the boost regex example in eclipse using mingw on vista. I built boost ok with mingw as there are library files XXXX.a. I could build/compile the first boost example that doesnt require any of the compiled boost libraries. When I compile the regex example I get a linker error saying it cant find the library file. I have tried various libray file names eg leave off the .a extension, leave off the lib prefix etc. Now the interesting thing is that if I leave off the library extension and rename the library file to XXX.lib it works and runs ok. So why cant it read the .a library file? It must be my setup somewhere but I dont know where or what to set. From what I read everyone is ok linking the .a file except me :( Thanks in advance, Kim

    Read the article

  • Regex: Use start of line/end of line signs (^ or $) in different context

    - by fgysin
    While doing some small regex task I came upon this problem. I have a string that is a list of tags that looks e.g like this: foo,bar,qux,garp,wobble,thud What I needed to do was to check if a certain tag, e.g. 'garp' was in this list. (What it finally matches is not really important, just if there is a match or not.) My first and a bit stupid try at this was to use the following regex: [^,]garp[,$] My idea was that before 'garp' there should either be the start of the line/string or a comma, after 'garp' there should be either a comma or the end of the line/string. Now, it is instantly obvious that this regex is wrong: Both ^ and $ change their behaviour in the context of the character class [ ]. What I finally came up with is the following: ^garp$|^garp,|,garp,|,garp$ This regex just handles the 4 cases one by one. (Tag at beginning of list, in the center, at the end, or as the only element of the list.) The last regex is somehow a bit ugly in my eyes and just for funs sake I'd like to make it a bit more elegant. Is there a way how the start of line/end of line characters (^ and $) can be used in the context of character classes?

    Read the article

  • What's wrong with this regex (VBScript/Javascript flavor)

    - by OtherMichael
    I'm trying to run a regular expression in VBA code that uses Microsoft VBScript Regular Expressions 5.5 (should be the same as JavaScript regex) regex: ^[0-9A-Z]?[0-9A-Z]{3}[A-Z]?([0-9A-Z]{6})-?([0-9])?$ input: X123A1234567 match: 123456 the six characters I'm interested in give a good match of 123456, ignoring the last (check) digit. Perfect. (The check digit is captured, but it's not a major concern to me). But when BOTH the optional portions are gone (they are optional) the match grabs the last digit GOOD input: 123A1234567 match: 123456 Leave in the optional middle alpha, take out the optional leading alpha, and we still get the good match of 123456 GOOD input: X1231234567 match: 123456 Leave in the optional leading alpha, take out the middle optional alpha, and we still get a good match of 123456 BAD input: 1231234567 match: 234567 Take out BOTH optional alphas, and we get a bad match of 234567 Have a looksee @ the regex testers on http://www.regular-expressions.info/javascriptexample.html or http://www.regular-expressions.info/vbscriptexample.html What am I missing, here? How can I get the regex to ignore the last digit when both optional alphas are missing? The regex is used to feed a lookup system, so that no matter what format the input data, we can match to a complete value.

    Read the article

  • How to write this in different regex flavours

    - by taspeotis
    I have the following data: a b c d FROM:<uniquepattern1> e f g h TO:<uniquepattern2> i j k l FROM:<uniquepattern1> m n o p TO:<uniquepattern3> q r s t FROM:<uniquepattern4> u v w x TO:<uniquepattern5> I would like a regex query that can find the contents of TO: when FROM:<uniquepattern1> is encountered, so the results would be uniquepattern2 and uniquepattern3. I am hopeless with regex, I would appreciate any pointers on how to write this (lookahead parameters?) and any differences between regex on different platforms (eg the C# .NET Regex versus Grep vs Perl) that might be relevant here. Thank you.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >