Search Results

Search found 4498 results on 180 pages for 'expression'.

Page 45/180 | < Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >

  • C#: Using regular expression (Regex) to duplicate a specific character in a string

    - by user3703944
    Anyone know how to use regex to duplicate a specific character in a string? I have a path that is entered like this: C:/Example/example I would like to use regex (or any other method) to display it like this: C://Example//example Is it possible? This is where I'm getting the file path private void btnSearchImage_Click_1(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp"; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string filenName = ofd.FileName; pictureBox1.Image = new Bitmap(filenName); string path = filenName; txtimgPath.Text = path; } } Thanks

    Read the article

  • Regular Expression to match a string

    - by Adam Witko
    Hi, I've got two possible string inputs that my application will receive, and if it matches the following two strings, I need it regex.ismatch() to return true: "User * has logged out" "User * has joined" I'm not that good at regex and just can't figure out how to go about matching the above. Any help would be great!!!

    Read the article

  • Regular expression - skip string in quotes using sed

    - by milano
    I have string like this: "Some standard text CONST_INSIDE_QUOTES" blah blah CONST "There might be another quotes" The thing is, that i want to replace all constants in string with some text, but it mustn't be applied on constants inside text in quotes. I have this regex: sed "s/([A-Z][A-Z0-9_]*)([^a-z])/<span class=\"const\"\1<\/span\2/g" which of course works for all consts. Any ideas how to exclude its apply on quotes constants? Unfortunately sed only...

    Read the article

  • Regular expression help

    - by dmr
    I need to do a find and replace in Notepad of Err.Number, canBeAnything, canBeAnything, Err.Description (where canBeAnything is just what it says) with Err.Number, "canBeAnything", "canBeAnything", Err.Description (basically, put quotes around canBeAnything) I got as far as the find Err.Number, .+, .+, Err.Description But I'm stuck on the replace. Any suggestions?

    Read the article

  • boolean VB expression returning false for integer 1

    - by Bill
    This is probably a really basic (no pun intended) question, but I can't seem to find an answer anywhere. Why does the result of func1 return False and func2 returns True? On every other test I have done, integer 1 is converted to boolean true and 0 to false. Works ok if I just set rtnValue to 1 or 0. Public Function func1() As Boolean Dim rtnValue As Integer = 0 Return rtnValue = 1 End Function Public Function func2() As Boolean Dim rtnValue As Integer = 0 Return rtnValue = 0 End Function

    Read the article

  • Regular expression - stop at first match

    - by publicRavi
    My pattern looks something like <xxxx location="file path/level1/level2" xxxx some="xxx"> I am only interested in the part in quotes assigned to location. Shouldn't it be as easy as below without the greedy switch? Does not seem to work :( /.*location="(.*)".*/

    Read the article

  • Regular expression problem

    - by sYl3r
    Hi, How can I search a whole string for a specific match. It'll contain both characters with int or decimal numbers eg A12B32.25C-456D-75.E75 I'll know that this will start with A and ends with E I think I can use "^" and "$" right? but i'm bit lost in other parts to check for character and int or decimal. I'll be glad if you can give the regex and explain it a bit :). PS. D-75. is not mistyped... Thanks in advance.

    Read the article

  • JS regular expression to find a substring surrounded by double quotes

    - by 2619
    I need to find a substring surrounded by double quotes, for example, like "test", "te\"st" or "", but not """ neither "\". To achieve this, which is the best way to go for it in the following 1) /".*"/g 2) /"[^"\\]*(?:\\[\S\s][^"\\]*)*"/g 3) /"(?:\\?[\S\s])*?"/g 4) /"([^"\\]*("|\\[\S\s]))+/g I was asked this question yesterday during an interview, and would like to know the answer for future reference.

    Read the article

  • Regular expression on range

    - by user1515425
    Sorry for these silly Question but i couldn't find a clue on my own I am a beginner at regexp language and I want someone help to find and replace the following value in content-range Http=Header Content-Range: bytes x-xxxxx/xxxx i want to find the xxxx value and replace it with yyyyy so the value will be x-xxxxxx/yyyy for example 0-423423/7777777 to be 0-423423/9999999 Can anyone help me in it thanks in advance

    Read the article

  • Regex to extract this semi formatted data

    - by Codygman
    Alright, I can't quite figure out how to do this. Given the following text: Roland AX-1: /start Roland's AX-1 strap-on remote MIDI controller has a very impressive 45-note velocity sensitive keyboard, and has switchable velocity curves, goes octave up/down, transpose, split/layering zones, and has fun tempo control for sequencers and more. Roland's AX-1 comes with a built-in GS control for total MIDI control of GM/GS synths. Its "Expression Bar" can control pitch and mod via an almost ribbon-like controller. It's also the newest and most advanced remote controller for your synths or midi modules. /end Roland AX-7: /start Roland's AX-7 builds on the infamous Roland AX-1 design. You just strap it on and put it to the front of the stage. Offering several controllers, such as: a D-Beam, then you can open the door to amazing live performance. 7-segment LED display, larger patch memory (Around 128 patches with MIDI data backup), and comes with GM2/GS compatibility make it extra easy to use. The 45-note, velocity-sensitive keyboard. 5 realtime controllers including a data entry knob, touch controller knob, opression bar, a hold button, and D-Beam. 128 patches with MIDI data backup. 2 MIDI zones. /end I'm trying to use the following: /^([\w\d \-]*):\s\s\s\s^\/start([^\:]*)\/end$/im You can see on rubular here: http://rubular.com/r/BVRRHsnWdp Thanks for any help. I guess i'm trying to match blocks of text until I hit the next title which always ends with a :$

    Read the article

  • VS2010 asking to upgrade SIlverlight??

    - by Lu10ntDan
    I'm running the absolute latest versions of Silverlight and Visual Studio 2010 Professional and built a solution that contained a WPF project. From there, I added a SketchFlow project (based on Blend 4 RC) and I can run each project within the solution just fine by setting whenever I switch between them as startup projects. From there, I added a Silverlight 4 Business Application (taking all the defaults), and when simply trying to set that as the startup project and running it, VS2010 is giving me the following error after trying to open a web page: Line: 56 (in file TestPage.aspx) Error: Unhandled Error in Silverlight Application Code: 8001 Category: InitializeError Message: Upgrade required If I choose not to debug, I get the Silverlight page saying "This page requires a more recent version of Silverlight"! Clicking "Install Now" on the popup window brings me to Mirosoft's Silverlight page where I see: "The version of Silverlight originally requested is not available. You can get a supported version from this page. This Web browser or operating system may not be compatible with Silverlight. Please review the system requirements and, if you wish to proceed, choose the link for your operating system." If I choose to upgrade anyway, I'm told that I'm running the latest version of Silverlight available. What the heck? I'm running the final versions of VS2010 Pro, Silverlight 4, and the latest version of Expression Blend 4 (RC). Why can't VS2010 run this default Silverlight Business App? Any ideas? Please?? Thanks, Lu10ntDn PS. This is on Windows 7 with UAC turned off, and ALL latest Windows Updates installed.

    Read the article

  • Parsing Lisp S-Expressions with known schema in C#

    - by Drew Noakes
    I'm working with a service that provides data as a Lisp-like S-Expression string. This data is arriving thick and fast, and I want to churn through it as quickly as possible, ideally directly on the byte stream (it's only single-byte characters) without any backtracking. These strings can be quite lengthy and I don't want the GC churn of allocating a string for the whole message. My current implementation uses CoCo/R with a grammar, but it has a few problems. Due to the backtracking, it assigns the whole stream to a string. It's also a bit fiddly for users of my code to change if they have to. I'd rather have a pure C# solution. CoCo/R also does not allow for the reuse of parser/scanner objects, so I have to recreate them for each message. Conceptually the data stream can be thought of as a sequence of S-Expressions: (item 1 apple)(item 2 banana)(item 3 chainsaw) Parsing this sequence would create three objects. The type of each object can be determined by the first value in the list, in the above case "item". The schema/grammar of the incoming stream is well known. Before I start coding I'd like to know if there are libraries out there that do this already. I'm sure I'm not the first person to have this problem.

    Read the article

  • How can I factor out repeated expressions in an SQL Query? Column aliases don't seem to be the ticke

    - by Weston C
    So, I've got a query that looks something like this: SELECT id, DATE_FORMAT(CONVERT_TZ(callTime,'+0:00','-7:00'),'%b %d %Y') as callDate, DATE_FORMAT(CONVERT_TZ(callTime,'+0:00','-7:00'),'%H:%i') as callTimeOfDay, SEC_TO_TIME(callLength) as callLength FROM cs_calldata WHERE customerCode='999999-abc-blahblahblah' AND CONVERT_TZ(callTime,'+0:00','-7:00') >= '2010-04-25' AND CONVERT_TZ(callTime,'+0:00','-7:00') <= '2010-05-25' If you're like me, you probably start thinking that maybe it would improve readability and possibly the performance of this query if I wasn't asking it to compute CONVERT_TZ(callTime,'+0:00','-7:00') four separate times. So I try to create a column alias for that expression and replace further occurances with that alias: SELECT id, CONVERT_TZ(callTime,'+0:00','-7:00') as callTimeZoned, DATE_FORMAT(callTimeZoned,'%b %d %Y') as callDate, DATE_FORMAT(callTimeZoned,'%H:%i') as callTimeOfDay, SEC_TO_TIME(callLength) as callLength FROM cs_calldata WHERE customerCode='5999999-abc-blahblahblah' AND callTimeZoned >= '2010-04-25' AND callTimeZoned <= '2010-05-25' This is when I learned, to quote the MySQL manual: Standard SQL disallows references to column aliases in a WHERE clause. This restriction is imposed because when the WHERE clause is evaluated, the column value may not yet have been determined. So, that approach would seem to be dead in the water. How is someone writing queries with recurring expressions like this supposed to deal with it?

    Read the article

  • What shall be the code in xaml which makes a particular image to act as a button?

    - by Abhi
    Dear all I am new to Silverlight. And i have to make a demo application where in designing is done by using Microsoft Expression Blend 2 and developing should be done using Visual Studio(c++). Now i am first trying to become familiar with xaml files. So i was trying to make a simple demo where in i have to create a button and that button should be replace with an png image. In order to do so i tried with the mentioned below example. But i was not able to see anything in the screen. <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="SilverlightApplication1.Page" Width="640" Height="480"> <Grid x:Name="LayoutRoot" Background="White"> <Button x:Name="LogoutButton" > <Button.Template> <ControlTemplate> <Image Source="SilverlightApplication1\bounce_photo.png" /> </ControlTemplate> </Button.Template> </Button> </Grid> Please let me know where i am wrong and what shall i do to obtain the result. With regards Abhineet Agarwal

    Read the article

  • Are there any libraries for parsing "number expressions" like 1,2-9,33- in Java

    - by mihi
    Hi, I don't think it is hard, just tedious to write: Some small free (as in beer) library where I can put in a String like 1,2-9,33- and it can tell me whether a given number matches that expression. Just like most programs have in their print range dialogs. Special functions for matching odd or even numbers only, or matching every number that is 2 mod 5 (or something like that) would be nice, but not needed. The only operation I have to perform on this list is whether the range contains a given (nonnegative) integer value; more operations like max/min value (if they exist) or an iterator would be nice, of course. What would be needed that it does not occupy lots of RAM if anyone enters 1-10000000 but the only number I will ever query is 12345 :-) (To implement it, I would parse a list into several (min/max/value/mod) pairs, like 1,10,0,1 for 1-10 or 11,33,1,2 for 1-33odd, or 12,62,2,10 for 12-62/10 (i. e. 12, 22, 32, ..., 62) and then check each number for all the intervals. Open intervals by using Integer.MaxValue etc. If there are no libs, any ideas to do it better/more efficient?)

    Read the article

  • Will my LinqToSql execution be deffered if i filter with IEnumerable<T> instead of IQueryable<T>?

    - by cottsak
    I have been using these common EntityObjectFilters as a "pipes and filters" way to query from a collection a particular item with an ID: public static class EntityObjectFilters { public static T WithID<T>(this IQueryable<T> qry, int ID) where T : IEntityObject { return qry.SingleOrDefault<T>(item => item.ID == ID); } public static T WithID<T>(this IList<T> list, int ID) where T : IEntityObject { return list.SingleOrDefault<T>(item => item.ID == ID); } } ..but i wondered to myself: "can i make this simpler by just creating an extension for all IEnumerable<T> types"? So i came up with this: public static class EntityObjectFilters { public static T WithID<T>(this IEnumerable<T> qry, int ID) where T : IEntityObject { return qry.SingleOrDefault<T>(item => item.ID == ID); } } Now while this appears to yield the same result, i want to know that when applied to IQueryable<T>s will the expression tree be passed to LinqToSql for evaluating as SQL code or will my qry be evaluated in it's entirety first, then iterated with Funcs? I'm suspecting that (as per Richard's answer) the latter will be true which is obviously what i don't want. I want the same result, but the added benefit of the delayed SQL execution for IQueryable<T>s. Can someone confirm for me what will actually happen and provide simple explanation as to how it would work?

    Read the article

  • Regular Expressions .NET

    - by Fosa
    I need a regular expression for some arguments that must match on a string. here it is... The string exists out of minimum 8 en maximum 20 characters. These characters of this string may be characters of the alfabet or special chars --With other words..all charachters except from the whitespaces In the complete string there must be atleast 1 number. The string cannot start with a number or an underscore The last 2 characters of the string must be identical, But it doenst matter if those last --identical characters are capital or non-capital (case insensitive) Must match all : +234567899 a_1de*Gg xy1Me*__ !41deF_hij2lMnopq3ss C234567890123$^67800 *5555555 sDF564zer"" !!!!!!!!!4!!!!!!!!!! abcdefghijklmnopq9ss May not match : Cannot be less then 8 or more then 20 chars: a_1+Eff B41def_hIJ2lmnopq3stt Cannot contain a whitespace: A_4 e*gg b41def_Hij2l nopq3ss Cannot start with a number or an underscore: __1+Eff 841DEf_hij2lmnopq3stt cannot end on 2 diffrent characters: a_1+eFg b41DEf_hij2lmnopq3st Cannot be without a number in the string: abCDefghijklmnopqrss abcdef+++dF !!!!!!!!!!!!!!!!!!!! ------------------------------------------------------ This is what I have so far...But I'm really breaking my head on this... If you Don't know the answer completely it's not a problem... I just want to get in the right direction ([^0-9_])(?=.*\d)(\S{8,20})(?i:[\S])\1

    Read the article

  • Servlet 3.1, Expression Language 3.0, Bean Validation 1.1, Admin Console Replay: Java EE 7 Launch Webinar Technical Breakouts on YouTube

    - by arungupta
    As stated previously (here, here, here, and here), the On-Demand Replay of Java EE 7 Launch Webinar is already available. You can watch the entire Strategy and Technical Keynote there, and all other Technical Breakout sessions as well. We are releasing the final set of Technical Breakout sessions on GlassFishVideos YouTube channel as well. In this series, we are releasing Servlet 3.1, Expression Language 3.0, Bean Validation 1.1, and Admin Console. Here's the Servlet 3.1 session: Here's the Expression Language 3.0 session: Here's the Bean Validation 1.1 session: And finally the Admin Console session: Enjoy watching all of them together in a consolidated playlist: And don't forget to download Java EE 7 SDK and try the numerous bundled samples.

    Read the article

  • If there's no problem treating a statement as an expression, why was there a distinction in the first place in some programming languages?

    - by cdmckay
    Why do we have the distinction between statements and expressions in most programming languages? For example, in Java, assuming f and g return ints, this still won't compile because it's a statement and statements don't return values. // won't compile int i = if (pred) { f(x); } else { g(x); } but in Scala, it's very happy with treating if as an expression. // compiles fine val i: Int = if (pred) f(x) else g(x) So if there's no problem treating an if statement as an expression, why was there a distinction in the first place?

    Read the article

< Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >