Jump to content

absfrm

New Members
  • Posts

    9
  • Joined

  • Last visited

absfrm's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. absfrm

    Using Regex

    To make strong $regex = "#([]*[])(.*)([]*[])#e"; $text = preg_replace($regex,"('<strong>$2</strong>')",$text); To Make Images $regex2 = "#([]![])(.*)([(])(.*)([]![])#e"; $text = preg_replace($regex2,"('<img src=\"$2\" alt=\"\">')",$text); To Make Italic $regex5 = "#([]_[])(.*)([]_[])#e"; $text = preg_replace($regex5,"('<i>$2</i>')",$text); To Make Strick $regex6 = "#([-])(.*)([-])#e"; $text = preg_replace($regex6,"('<s>$2</s>')",$text); To put <br > for each empty line. $text = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "<br>", $text); Now i want to do these actions : @ some code @ Change first '@' with <pre > and last '@' to </ pre> i can't detect that character is the first character of line! if both '@' are first character of line,then do change it And change if Line start with '*.' or '* '(with space after it) , and end with 'enter' or '\n' or '<br>'(end line) change start , with <li > and end with </li >
  2. absfrm

    Using Regex

    $regex = "#([]*[])(.*)([]*[])#e"; preg_replace($regex,"('<b>$2</b>')",$text); i could fix *sometext* by above regex. this changed the start * with <b > and end tag with </b >
  3. absfrm

    Using Regex

    Just for test ^ sad as dasd ^sa da da sa some text متن(UTF-8 string) *.sometext * sometext #.some text # some text some text @ String mystr = "test@example.com" String mystr = test@@@@::example.com; @ *some text* -some text- Other Image it showed me this text. just Links works right.
  4. absfrm

    Using Regex

    i could fix images by array. and for each character , i detected those and changed with html tags and its work now with alternative text! ok special thanks to you sir.
  5. absfrm

    Using Regex

    oohh man.your are very nice! this is my $text: $text = 'Just for test ^ sad as dasd ^sa da da sa "some text":http://google.com "متن(UTF-8 string)":http://google.com *.sometext * sometext #.some text # some text some text !http://static.php.ne...es/php.gif(This is image's Alternative)! @ String mystr = "test@example.com" String mystr = test@@@@::example.com; @ *some text* _some text_ -some text- Other Image !http://static.php.net/images/php.gif(This is image's Alternative Text)! ' No Different between '*.' and '* ' both are '<li > < /li>' No Different between '#.' and '# ' both are <ol></ol>
  6. absfrm

    Using Regex

    yes. 1: "Text Link":http://site.com It want to be a html link with url after ':' and before 'space' at the end, and link's text is string between the quotations 2: !http://site.com/picture.gif! It want to be a html img tag: <img src='link between two "!" characters' /> 3: *.my text It want to be an item in html tag : <li>mytext after "*." and befire "enter" (new line)</li> 4: _some text_ it want to be an <i> ' some text between to _' and close with </i> 5 : -some text- it want to be and <s> 'some text between to -' and close with </s>
  7. absfrm

    Using Regex

    thanks for your reply $text = preg_replace("/.**{2}(.+?)\*{2}.*/", "<b>$1</b>", $text); for example this code to change *sometext* to <b>sometext</b>. but its work with 2 * before and after 'sometext'. and for other tags,i dont know what should i do.really.
  8. absfrm

    Using Regex

    I have a question to use regex in PHP. i have a string in murkup.and wanna to convert it to html. These are my strings: 1. "Text Link":http://site.com It want to be a html link with url after : and before "space" at the end, and link's text is string between the quotations 2. !http://site.com/picture.gif! It want to be a html img tag: <img src='link between "!" characters' /> 3. *.my text It want to be an item in html tag : <li>mytext after "*." and before "enter" (new line)</li> or etc. how can i do it? i try many solutions in regex but not worked right. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.