Search Results

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

Page 42/180 | < Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >

  • Please explain this php expression "!$variable"

    - by DogBot
    What does an exclamaton mark in front of a variable mean? And how is it being used in this piece of code? EDIT: From the answers so far I suspect that I also should mention that this code is in a function where one of the parameters is $mytype ....would this be a way of checking if $mytype was passed? - Thanks to all of the responders so far. $myclass = null; if ($mytype == null && ($PAGE->pagetype <> 'site-index' && $PAGE->pagetype <>'admin-index')) { return $myclass; } elseif ($mytype == null && ($PAGE->pagetype == 'site-index' || $PAGE->pagetype =='admin-index')) { $myclass = ' active_tree_node'; return $myclass; } elseif (!$mytype == null && ($PAGE->pagetype == 'site-index' || $PAGE->pagetype =='admin-index')) { return $myclass; }`

    Read the article

  • RegEx expression or jQuery selector to NOT match "external" links in href

    - by TrueBlueAussie
    I have a jQuery plugin that overrides link behavior, to allow Ajax loading of page content. Simple enough with a delegated event like $(document).on('click','a', function(){});. but I only want it to apply to links that are not like these ones (Ajax loading is not applicable to them, so links like these need to behave normally): target="_blank" // New browser window href="#..." // Bookmark link (page is already loaded). href="afs://..." // AFS file access. href="cid://..." // Content identifiers for MIME body part. href="file://..." // Specifies the address of a file from the locally accessible drive. href="ftp://..." // Uses Internet File Transfer Protocol (FTP) to retrieve a file. href="http://..." // The most commonly used access method. href="https://..." // Provide some level of security of transmission href="mailto://..." // Opens an email program. href="mid://..." // The message identifier for email. href="news://..." // Usenet newsgroup. href="x-exec://..." // Executable program. href="http://AnythingNotHere.com" // External links Sample code: $(document).on('click', 'a:not([target="_blank"])', function(){ var $this = $(this); if ('some additional check of href'){ // Do ajax load and stop default behaviour return false; } // allow link to work normally }); Q: Is there a way to easily detect all "local links" that would only navigate within the current website? excluding all the variations mentioned above. Note: This is for an MVC 5 Razor website, so absolute site URLs are unlikely to occur.

    Read the article

  • Javascript: regular expression

    - by Dmitry Nesteruk
    I need to replace a substring from some string. I've already created corrected code for doing it. But I amn't sure is it best way. Please, see code below: var str = 'test ruby,ruby on rails,ruby,' var substr = 'ruby'; var reg = new RegExp(',' + substr + ',|^' + substr + ',', 'gi'); str.replace(reg, ','); //returns "test ruby,ruby on rails,"

    Read the article

  • Java regular expression: how to include '-'

    - by changed
    I am using this pattern and matching a string. String s = "//name:value /name:value"; if (s.matches("(//?\\s*\\w+:\\w+\\s*)+")) { // it fits } This works properly. But if I want to have a string like "/name-or-address:value/name-or-address:value" which has this '-' in second part, it doesn't work. I am using \w to match A-Za-z_, but how can I include - in that?

    Read the article

  • Write an expression in javascript

    - by Hero
    hi everybody... I need a javascript code that split a string like below: Input string: "a=aa| b=b||b | c=cc" Output: a=>aa b=>b||b c=>cc I'd written different codes like: split(/ \ | /) or Split(/ \| (?! \ |) /) but didn't work. please help me... I really need it fast.

    Read the article

  • complex regular expression task

    - by Don Don
    Hi, What regular expressions do I need to extract section title(s) in a text file? So, in the following sample text, I'd like to extract "Communication and Leadership" "1.Self-Knowledge" "2. Humility" "(3) Clear Thinking". Many thanks. Communication and Leadership True leaders understand that, rather than forcing their followers into a preconceived mold, their job is to motivate and organize followers to collectively accomplish goals that are in everyone's interests. The ability to communicate this to co-workers and followers is critical to the effectiveness of leadership. 1.Self-Knowledge Superior leaders are able to devote their skills and energies to leadership of a group because they have worked through personal issues to the point where they know themselves thoroughly. A high level of self-knowledge is a prerequisite to effective communication skills, because the things that you communicate as a leader are coming from within. 2. Humility This subversion of personal preference requires a certain level of humility. Although popular definitions of leaders do not always see them as humble, the most effective leaders actually are. This humility may not be expressed in self-effacement, but in a total commitment to the goals of the organization. Humility requires an understanding of one's own relative unimportance in comparison to larger systems. (3) Clear Thinking Clarity of thinking translates into clarity of communication. A leader whose goals or personal analysis is muddled will tend to deliver unclear or ambiguous directions to followers, leading to confusion and dissatisfaction. A leader with a clear mind who is not ambivalent about her purposes will communicate what needs to be done in a s traightforward and unmistakable manner.

    Read the article

  • Match a comma followed by a newline with a regular expression

    - by MarathonStudios
    I have a comma delimited list I want to import into a database, and in some cases the last item is blank: item1, item2, item3 item1, item2, item1, item2, I'd like to replace all of these empty columns with a placeholder value using a regexp item1, item2, item3 item1, item2, PLACEHOLDER item1, item2, PLACEHOLDER I tried preg_replace("/,\n/", ",PLACEHOLDER\n",$csv);, but this isn't working. Anyone know what regexp would work for this?

    Read the article

  • Complex regular expression

    - by Jose3d
    Hello, i will like to capture a substring part of a text choosing the number of characters but if any word is cut then get until de last blank. As example if this is the text: "This is an example of text lorem ipsum, etc..." and i would like to get for instance 12 characters that are: "This is an e". In this case example is cutted, then i would like to get "This is an". Its possible do this with Regular Expressions? Thanks in advance. Jose

    Read the article

  • How optimize by lambda expression

    - by simply denis
    I have a very similar function is only one previous report and the other future, how can I optimize and write beautiful? public bool AnyPreviousReportByGroup(int groupID) { if(this.GroupID == groupID) { return true; } else { return PreviousReport.AnyPreviousReportByGroup(groupID); } } public bool AnyNextReportByGroup(int groupID) { if (this.GroupID == groupID) { return true; } else { return NextReport.AnyNextReportByGroup(groupID); } }

    Read the article

  • Regular expression on a URL

    - by alphaexe
    I need to be able to catch when the URL contains a image of multiple file types or follow this syntax. http://localhost:8080/fdlic-web/webpic/101 Here is what i have so far. (.*)(jpg|gif|png|bmp|jpeg|webpic/(\d+))$

    Read the article

  • How can I build value for "for-each" expression in XSLT with help of parameter

    - by Artic
    I need to navigate through this xml tree. <publication> <corporate> <contentItem> <metadata>meta</metadata> <content>html</content> </contentItem> <contentItem > <metadata>meta1</metadata> <content>html1</content> </contentItem> </corporate> <eurasia-and-africa> ... </eurasia-and-africa> <europe> ... </europe> </publication> and convert it to html with this stylesheet <ul> <xsl:variable name="itemsNode" select="concat('publicationManifest/',$group,'/contentItem')"></xsl:variable> <xsl:for-each select="$itemsNode"> <li> <xsl:value-of select="content"/> </li> </xsl:for-each> </ul> $group is a parameter with name of group for example "corporate". I have an error with compilation of this stylsheet. SystemID: D:\1\contentsTransform.xslt Engine name: Saxon6.5.5 Severity: error Description: The value is not a node-set Start location: 18:0 What the matter?

    Read the article

  • Regex "or" Expression

    - by David
    This is probably a really basic question, but I can't find any answers. I need to match a string by either one or more spaces OR an equals sign. When I split this string: 9 x 13 = (8.9 x 13.4) (89 x 134) with ( +) I get: part 0: 9 x 13 = (8.9 x 13.4) part 1: (89 x 134) When I split it with (=) I get: part 0: 9 x 13 part 1: (8.9 x 13.4) (89 x 134) How can split by BOTH? Something like: (=)OR( +) Edit: This does not work(=)|( +) Test it here: http://myregexp.com/ under "split".

    Read the article

  • Python regular expression

    - by user3692739
    I have this HTTP Request and I want to display only the Authorization section (base64 Value) : any help ? This Request is stored on a variable called hreq I have tried this : reg = re.search(r"Authorization:\sBasic\s(.*)\r", hreq) print reg.group() but doesn't work Here is the request : HTTP Request: Path: /dynaform/custom.js Http-Version: HTTP/1.1 Host: 192.168.1.254 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://domain.com/userRpm/StatusRpm.htm Authorization: Basic YWhtEWa6MDfGcmVlc3R6bGH I want to display the value YWhtEWa6MDfGcmVlc3R6bGH Please I need your help thanks in advance experts

    Read the article

  • Php regular expression to match a div

    - by Thoman
    Hello all <div id="a"> <div id="b"> Foo </div> <div id="m"> Bar </div> </div> <div id="c"> Bar </div> I want find all object in id="a" and out put is <div id="a"> <div id="b"> Foo </div> <div id="m"> Bar </div> </div> Geat thanks.

    Read the article

  • Regular Expression to parse SQL Structure

    - by user351429
    I am trying to parse the MySQL data types returned by "DESCRIBE [TABLE]". It returns strings like: int(11) float varchar(200) int(11) unsigned float(6,2) I've tried to do the job using regular expressions but it's not working. PHP CODE: $string = "int(11) numeric"; $regex = '/(\w+)\s*(\w+)/'; var_dump( preg_split($regex, $string) );

    Read the article

  • Pick up relevant information from a string using regular expression C#3.0

    - by Newbie
    Hi, I have a situation. I have been given some file name which can be like <filename>YYYYMMDD<fileextension> some valid file names that will satisfy the above pattern are as under xxx20100326.xls, xxx2v20100326.csv, x_20100326.xls, xy2z_abc_20100326_xyz.csv, abc.xyz.20100326.doc, ab2.v.20100326.doc, abc.v.20100326_xyz.xls In what ever be the above defined case, I need to pick up the dates only. So for all the cases, the output will be 20100326. I am trying to achieve the same but no luck. Here is what I have done so far string testdata = "x2v20100326.csv"; string strYYYY = @"\d{4}"; string strMM = @"(1[0-2]|0[1-9])"; string strDD = @"(3[0-1]|[1-2][0-9]|0[1-9])"; string regExPattern = @"\A" + strYYYY + strMM + strDD + @"\Z"; Regex regex = new Regex(regExPattern); Match match = regex.Match(testdata); if (match.Success) { string result = match.Groups[0].Value; } I am using c#3.0 and dotnet framework 3.5 Please help. It is very urgent Thanks in advance.

    Read the article

  • C# : Regular Expression

    - by Pramodh
    I'm having a set of row data as follows List<String> l_lstRowData = new List<string> { "Data 1 32:01805043*0FFFFFFF", "Data 3, 20.0e-3", "Data 2, 1.0e-3 172:?:CRC" , "Data 6" }; and two List namely "KeyList" and "ValueList" like List<string> KeyList = new List<string>(); List<string> ValueList = new List<string>(); I need to fill the two List<String> from the data from l_lstRowData using Pattern Matching And here is my Pattern for this String l_strPattern = @"(?<KEY>(Data|data|DATA)\s[0-9]*[,]?[ ][0-9e.-]*)[ \t\r\n]*(?<Value>[0-9A-Za-z:?*!. \t\r\n\-]*)"; Regex CompiledPattern=new Regex(l_strPattern,RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); So finally the two Lists will contain KeyList { "Data 1" } { "Data 3, 20.0e-3" } { "Data 2, 1.0e-3" } { "Data 6" } ValueList { "32:01805043*0FFFFFFF" } { "" } { "172:?:CRC" } { "" } Scenerio: The Group KEY in the Pattern Should match "The data followed by an integer value , and the if there exist a comma(,) then the next string i.e a double value The Group Value in the Pattern should match string after the whitespace.In the first string it should match 32:01805043*0FFFFFFF but in the 3rd 172:?:CRC. Here is my sample code for (int i = 0; i < l_lstRowData.Count; i++) { MatchCollection M = CompiledPattern.Matches(l_lstRowData[i], 0); KeyList.Add(M[0].Groups["KEY"].Value); ValueList.Add(M[0].Groups["Value"].Value); } But my Pattern is not working in this situation. Please help me to rewrite my Pattern.

    Read the article

  • Correct expression for checking leap years

    - by Debanjan
    What will be the exact definition of leap year? AFAIK "A year which is divisible by 4 is a leap year. But for century years' the years which are divisible by 400 is a leap year." But that definition makes 100, 200, 300, 400.... upto 1700 NOT LEAP years! But in Gregorian calendar all of them are all leap year, check this out. You can also try "call 1700" in Linux to verify. So the correct algorithm for leap years would be: if ( (year % 4 == 0) && ( year <= 1700 || year % 100 != 0 || year % 400 == 0 )) printf("%d is a leap year.\n", year); else printf("%d is not a leap year.\n", year); But is this specific to Gregorian calendar? Even if that is the case why is it not mentioned here? Regards, PS:The history of Gregorian callender seems interesting check out the September month of 1752.

    Read the article

< Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >