Search Results

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

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

  • Vim syntax highlighting: make region only match on one line

    - by sixtyfootersdude
    Hello I have defined a custom file type with these lines: syn region SubSubtitle start=+=+ end=+=+ highlight SubSubtitle ctermbg=black ctermfg=DarkGrey syn region Subtitle start=+==+ end=+==+ highlight Subtitle ctermbg=black ctermfg=DarkMagenta syn region Title start=+===+ end=+===+ highlight Title ctermbg=black ctermfg=yellow syn region MasterTitle start=+====+ end=+====+ highlight MasterTitle cterm=bold term=bold ctermbg=black ctermfg=LightBlue I enclose all of my headings in this kind of document like this: ==== Biggest Heading ==== // this will be bold and light blue ===Sub heading === // this will be yellow bla bla bla // this will be normally formatted However right now when ever I use an equals sign in my code it thinks that it is a title. Is there anyway that I can force a match to be only on one line?

    Read the article

  • no match for operator= using a std::vector

    - by Max
    I've got a class declared like this: class Level { private: std::vector<mapObject::MapObject> features; (...) }; and in one of its member functions I try to iterate through that vector like this: vector<mapObject::MapObject::iterator it; for(it=features.begin(); it<features.end(); it++) { /* loop code */ } This seems straightforward to me, but g++ gives me this error: src/Level.cpp:402: error: no match for ‘operator=’ in ‘it = ((const yarl::level::Level*)this)-yarl::level::Level::features.std::vector<_Tp, _Alloc::begin [with _Tp = yarl::mapObject::MapObject, _Alloc = std::allocator<yarl::mapObject::MapObject>]()’ /usr/include/c++/4.4/bits/stl_iterator.h:669: note: candidates are: __gnu_cxx::__normal_iterator<yarl::mapObject::MapObject*,std::vector & __gnu_cxx::__normal_iterator<yarl::mapObject::MapObject*,std::vector >::operator=(const __gnu_cxx::__normal_iterator<yarl::mapObject::MapObject*, ``std::vector<yarl::mapObject::MapObject, std::allocator<yarl::mapObject::MapObject> > >&) Anyone know why this is happening?

    Read the article

  • Match beginning of words in Mysql for UTF8 strings

    - by ankimal
    Hi, I m trying to match beignning of words in a mysql column that stores strings as varchar. Unfortunately, REGEXP does not seem to work for UTF-8 strings as mentioned here So, select * from names where name REGEXP '[[:<:]]Aandre'; does not work if I have name like Foobar Aándreas However, select * from names where name like '%andre%' matches the row I need but does not guarantee beginning of words matches. Is it better to do the like and filter it out on the application side ? Any other solutions?

    Read the article

  • Scala wont pattern match with java.lang.String and Case Class

    - by Stefan
    Hello fellow Scala Programmers I have been working with Scala for some month now, however I have a problem with some properly basic stuff, I am hoping you will help my out with it. case class PersonClass(name: String, age: Int) object CaseTester { def main(args:Array[String]) { val string = "hej" string match { case e:String => println(string) case PersonClass => println(string) } } } When I am doing like this I get error: pattern type is incompatible with expected type; found : object PersonClass required: java.lang.String case PersonClass = println(string) And if I then change the second line in the pattern matching to the following: case e:PersonClass => println(string) I then get the error: error: scrutinee is incompatible with pattern type; found : PersonClass required: java.lang.String case e:PersonClass = println(string) However if I change the string definition to the following it compiles fine in both cases. val string:AnyRef = "hej"

    Read the article

  • regex partial match for several different groups

    - by koral
    I need regexp to match string build from several groups (A is any letter, 9 is any digit): group 1 regex [A-Z]{1,2}[0-9]? A A9 AA9 group 2 regex [A-Z]{1,3}[0-9]? A AA AAA AAA9 group 3 regex [A-Z]{2,3}[0-9]?[A-Z]? AAA AA9 AA9A group 4 regex [0-9]{1,2}[A-Z]{1,2}[0-9]? 9A 9AA 9A9 99A9 Not each group must be present but there must be all in correct order - I mean (digit is group number): 1 12 123 1234 So if there is present group 3 there must me all preceding groups present also. As there are four groups (can be more), so alternative like ^[A-Z]{1,2}[0-9]{1}|[A-Z]{1,2}[0-9]{1}\s{1}[A-Z]{1}[0-9]?$ is not the best option as it would be complicated and difficult to maintain. Is there any solution with groups or something? The order of groups is important.

    Read the article

  • Using Simple HTML Dom to match a string on the page

    - by Abs
    Hello all, How do I match and get the flash vars on a HTML page? I am using simple HTML dom element and I am able to narrow down to a div containing the text I need. <script type="text/javascript"> var s1 = new SWFObject("jw4.4/player.swf", "player", "400", "50", "9"); s1.addParam("allowfullscreen", "true"); s1.addParam('allowscriptaccess','always'); s1.addVariable("width","400"); s1.addVariable("height","50"); s1.addVariable("overstretch", "false"); s1.addParam('flashvars',"this_id=/tg&amp;autostart=true"); s1.write("container"); How do I get the value of this_id, so I want to return /tg? What would I put in find? Or do i have to use something else? $html = file_get_html("$url"); $file_path = $html->find('this_id=/'); Thanks all for any help

    Read the article

  • displaying current minute of a soccer match

    - by zurna
    I could not figure out the logic I would need to display a current minute of a soccer match. I have three fields in the database. DateFirstStarted DateSecondStarted DateFullEnded I should enter DateFirstStarted when the game starts and on the website. i.e. game starts at 7:05pm, on 7:25pm it should display '20 on the website. However, it should stop on the 45th minute. Then, I enter DateSecondStarted when the second half starts and should count from 46 to 90 and freeze there. Do I make sense? How can I do it? Is there a better way to do this?

    Read the article

  • Code coordinates to match compass bearings

    - by pinnacler
    Right now in Matlab (0,0) is the origin, 0 degrees / 2pi would be to the right of the cartesian plane and angles are measured counter clockwise with 90 degrees being at the top. I'm trying to write a simulator where the coordinates would match a compass bearing. 0/360 degrees or 2pi would be at the top and 90 degrees would be on the right. Any idea how to code in Matlab or c++? I'd imaging it'd be a matrix flipped about the x axis and rotated 90 degrees but I'm at a total loss. Phil

    Read the article

  • accessing values in a Map container, then try to match them

    - by wilson88
    Trying to compare the prices of the bids in the two maps.Sellers map and the buyers map. Conditions for comparison. 1) One bid is A and the other is B 2) Price of B i greater than price of A. I then copy the matched bids to a container called matched.I am not sure how to do the match of maps. map<int, Bid*> bidtable/Before matching map<int, Bid*> matched map<int, Bid*> unmatched

    Read the article

  • match elements from two files, how to write the intended format to a new file

    - by user2489612
    I am trying to update my text file by matching the first column to another updated file's first column, after match it, it will update the old file. Here is my old file: Name Chr Pos ind1 in2 in3 ind4 foot 1 5 aa bb cc ford 3 9 bb cc 00 fake 3 13 dd ee ff fool 1 5 ee ff gg fork 1 3 ff gg ee Here is the new file: Name Chr Pos foot 1 5 fool 2 5 fork 2 6 ford 3 9 fake 3 13 The updated file will be like: Name Chr Pos ind1 in2 in3 ind4 foot 1 5 aa bb cc fool 2 5 ee ff gg fork 2 6 ff gg ee ford 3 9 bb cc 00 fake 3 13 dd ee ff Here is my code: #!/usr/bin/env python import sys inputfile_1 = sys.argv[1] inputfile_2 = sys.argv[2] outputfile = sys.argv[3] inputfile1 = open(inputfile_1, 'r') inputfile2 = open(inputfile_2, 'r') outputfile = open(outputfile, 'w') ind = inputfile1.readlines() cm = inputfile2.readlines()[1:] outputfile.write(ind[0]) #add header for i in ind: i = i.split() for j in cm: j = j.split() if j[0] == i[0]: outputfile.writelines(j[0:3] + i[3:]) inputfile1.close() inputfile2.close() outputfile.close() When I ran it, it returned a single column rather than the format i wanted, any suggestions? Thanks!

    Read the article

  • Algorithm to match natural text in mail

    - by snøreven
    I need to separate natural, coherent text/sentences in emails from lists, signatures, greetings and so on before further processing. example: Hi tom, last monday we did bla bla, lore Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. list item 2 list item 3 list item 3 Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid x ea commodi consequat. Quis aute iure reprehenderit in voluptate velit regards, K. ---line-of-funny-characters-####### example inc. 33 evil street, london mobile: 00 234534/234345 Ideally the algorithm would match only the bold parts. Is there any recommended approach - or are there even existing algorithms for that problem? Should I try approximate regular expressions or more statistical stuff based on number of punctation marks, length and so on?

    Read the article

  • Facebook insights for websites does not match on-site Facebook button counts

    - by Will
    I use Facebook Insights for websites and Facebook buttons on my site. However, the data reported by the two do not match. It always seems to be the case that the count reported by the buttons is significantly higher than the count reported in Facebook Insights. For example, this page http://www.appmyworld.com/blog/top-5-iphone-and-ipad-apps-of-the-week-10412.html has a count of 52 for Facebook which is made up of 19 likes, 21 shares and 12 comments according to AddThis and confirmed by http://sharedcount.com However, going into Facebook Insights for my website and looking at that specific page it shows only 4 total actions which is made up of 1 like and 3 shares. At the very least I would expect it to show a total count of 40 made up of 19 likes and 21 shares (I'm not sure it would track the 12 comments). Any thoughts on why this may be happening? My concern is if our website is not getting credit for the Facebook activity?

    Read the article

  • Regexp look-behind to match internet speeds

    - by Sandman
    So the user may search for "10 mbit" after which I want to capture the "10" so I can use it in a speed-search rather than a string-search. This isn't a problem, the below regexp does this fine: if (preg_match("/(\d+)\smbit/", $string)){ ... } But, the user may search for something like "10/10 mbit" or "10-100 mbit". I don't want to match those with the above regexp - they should be handled in another fashion. So I would like a regexp that matches "10 mbit" if the number is all-numeric as a whole word (i.e. contained by whitespace, newline or lineend/linestart) Using lookbehind, I did this: if (preg_match("#(?<!/)(\d+)\s+mbit#i", $string)){ Just to catch those that doesn't have "/" before them, but this matched true for this string: "10/10 mbit" so I'm obviously doing something wrong here, but what?

    Read the article

  • The Columns in table <table> do not match an existing primary key or unique constraint

    - by Sven
    I have 2 tables, Stores - storeId (int) and year (int(4)) both Primary Keys. fruit - fruitId - Primary Key and storeId. I need to create 1 to many relationship between the Store and Fruit (Foreign Key held within Fruit) how ever I always get shown the error - The Columns in table <table> do not match an existing primary key or unique constraint. The type's are both int and named the same. Any help would be appreciate in advance, many thanks.

    Read the article

  • jQuery replace first string match

    - by P4tient
    I have an array, like var acronyms = { 'NAS': 'Nunc ac sagittis', 'MTCP': 'Morbi tempor congue porta' }; I need to find first match of each acronym and wrap around with tag via jQuery. E.g. <div id="wrap">NAS dui pellentesque pretium augue. MTCP pellentesque pretium augue. NAS ac ornare lectus MTCP nec.</div> becomes <div id="wrap"><acronym title="Nunc ac sagittis">NAS</acronym> dui pellentesque pretium augue. <acronym title="Morbi tempor congue porta">MTCP</acronym> pellentesque pretium augue. NAS ac ornare lectus MTCP nec.</div> Thanks.

    Read the article

  • How to align floated elements such that their bottoms match

    - by AJM
    I'm writing a web page where I show a title and a date over some text. My HTML: <div class="post"> <h2>Post 1</h2> <span class="date">February 28, 2011</span> <div class="post-content"> ... </div> </div> My css: .post h2 { float: left; } .date { float: right; } .post-content { clear: both; } What I want to do is vertically align the title and date such that their bottoms match. Right now they don't: I tried wrapping the two text elements in a div, setting the div's position to relative, and using absolute positioning on the two text elements (and taking out the float declarations). That didn't work because the top margin is not preserved due to the wrapper div collapsing, even though I gave it a clearfix class.

    Read the article

  • Scala match/compare enumerations

    - by williamstw
    I have an enumeration that I want to use in pattern matches in an actor. I'm not getting what i'd expect and, now, I'm suspecting I'm missing something simple. My enumeration, object Ops extends Enumeration { val Create = Value("create") val Delete = Value("delete") } Then, I create an Ops from a String: val op = Ops.valueOf("create") Inside my match, I have: case (Ops.Create, ...) But Ops.Create doesn't seem to equal ops.valueOf("create") The former is just an atom 'create' and the later is Some(create) Hopefully, this is enough info for someone to tell me what I'm missing... Thanks

    Read the article

  • Passing a pointer to a function that doesn't match the requirements of the formal parameter

    - by Andreas Grech
    int valid (int x, int y) { return x + y; } int invalid (int x) { return x; } int func (int *f (int, int), int x, int y) { //f is a pointer to a function taking 2 ints and returning an int return f(x, y); } int main () { int val = func(valid, 1, 2), inval = func(invalid, 1, 2); // <- 'invalid' does not match the contract printf("Valid: %d\n", val); printf("Invalid: %d\n", inval); /* Output: * Valid: 3 * Invalid: 1 */ } At the line inval = func(invalid, 1, 2);, why am I not getting a compiler error? If func expects a pointer to a function taking 2 ints and I pass a pointer to a function that takes a single int, why isn't the compiler complaining? Also, since this is happening, what happens to the second parameter y in the invalid function?

    Read the article

  • Method params match signature, but still getting error

    - by Jason
    I am in the midst of converting a VB library to C#. One of my methods has the following signature in VB: Private Shared Sub FillOrder(ByVal row As DataRowView, ByRef o As Order) In C# I converted it to: private static void FillOrder(DataRowView row, ref Order o) From my constructor inside my Order class, I am calling the FillOrder() method like so: DataView dv = //[get the data] if (dv.Count > 0) { FillOrder(dv[0], this); } In VB, this works: Dim dv As DataView = '[get data]' If dv.Count > 0 Then FillOrder(dv.Item(0), Me) End If However, in VS10 in the C# file I am getting a red squiggle under this call with the following error: The best overloaded method match for [the method] has some invalid arguments This was working code in VB. What am I doing wrong?

    Read the article

  • MySQL - Where - search string - MATCH.

    - by Jamie
    Hi guys, Quick question. I'm in a bit of a rush but if someone could quickly point me in the right direction I would be very very happy. I have a field in the db, let's call it field_a which returns a string in the format "20,50,60,80" etc. I wish to do a query which will search in this field to see if 20 exists. Could I use MySQL MATCH or is there a better way? Thank you!

    Read the article

  • Regular Expressions - Match all alphanumeric characters except individual numbers

    - by imaginonic
    I would like to create a RegEx to match only english alphanumeric characters but ignore (or discard) isolated numbers in Ruby (and if possible in JS too). Examples: 1) I would like the following to be matched: 4chan 9gag test91323432 asf5asdfaf35edfdfad afafaffe But not: 92342424 343424 34432 and so on.. The above is exactly what I would want. 2) However, I would be really thankful if someone could also include French letters like: é ë ê (These are just few examples of many) 1) is my priority, it's totally okay if 2) is impossible or difficult to implement. Sorry, my regex skills aren't that great (hence this question!) Thank you.

    Read the article

  • Match two mysql cols on alpha chars (ignoring numbers in same field)

    - by Steve
    I was wondering if you know of a way I could filter a mysql query to only show the ‘alpha’ characters from a specific field So something like SELECT col1, col2, **alpha_chars_only(col3)** FROM table I am not looking to update only select. I have been looking at some regex but without much luck most of what turned up was searching for fields that only contain ‘alpha’ chars. In a much watered down context... I have col1 which contains abc and col two contains abc123 and I want to match them on alpha chars only. There can be any number of letters or numbers. Any help very much wel come

    Read the article

  • Java splitting string by custom regex match

    - by slikz
    I am completely new to regular expressions so I'm looking for a bit of help here. I am compiling under JDK 1.5 Take this line as an example that I read from standard input: ab:Some string po:bubblegum What I would like to do is split by the two characters and colon. That is, once the line is split and put into a string array, these should be the terms: ab:Some string po:bubblegum I have this regex right now: String[] split = input.split("[..:]"); This splits at the semicolon; what I would like is for it to match two characters and a semicolon, but split at the space before that starts. Is this even possible? Here is the output from the string array: ab Some String po bubblegum I've read about Pattern.compile() as well. Is this something I should be considering?

    Read the article

  • Django: Why Doesn't the Current URL Match any Patterns in urls.py

    - by austin_sherron
    I've found a few questions here related to my issue, but I haven't found anything that has helped me resolve my issue. I'm using Python 2.7.5 and Django 1.8.dev20140627143448. I have a view that's interacting with my database to delete objects, and it takes two arguments in addition to a request: def delete_data_item(request, dataclass_id, dataitem_id): form = AddDataItemForm(request.POST) data_set = get_object_or_404(DataClass, pk=dataclass_id) context = {'data_set': data_set, 'form': form} data_item = get_object_or_404(DataItem, pk=dataitem_id) data_item.delete() data_set.save() return HttpResponseRedirect(reverse('detail', args=(dataclass_id,))) The URL in myapp.urls.py looks something like this: url(r'^(?P<dataclass_id>[0-9]+)/(?P<dataitem_id>[0-9]+)/delete_data_item/$', views.delete_data_item, name='delete_data_item') and the portion of my template relevant to the view is: <a href="{% url 'delete_data_item' data_set.id data_item.id %}">DELETE</a> Whenever I click on the DELETE link, django tells me that the request URL: http://127.0.0.1:8000/myapp/5/%7B%%20url%20'delete_data_item'%20data_set.id%20data_item.id%20%%7D doesn't match any of my URL patterns. What am I missing? The URL on which the DELETE links exist is myapp/(<dataclass_id>[0-9]+)/

    Read the article

  • Template Match and document

    - by Christophe Debove
    Can I do something like that to display the value of the node? <!-- plop.xml : --> <?xml version="1.0"?> <root> <node1>hello</node1> </root> <xsl:template name="my_template" match="document('plop.xml')/root" > <xsl:value-of select="node1"/> </xsl:template> <xsl:call-template name="my_template"></xsl:call-template> I want to create special template that will only affect one xml. I work on asp .net 2.0 C# XslCompiledTransform processor.

    Read the article

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