Creating a regex.Pattern for bulletin board tags

I'm making a BB code system and have a problem making my patterns do as I like. At least when they are nested.
For example, I'm using the this pattern:
\\[b\\](.*?)\\[/b\\]And I'm replacing it with this:
<b>{0}</b>If I apply this to the text:
This is my text with bold words. Sometimes the tags [b]are nested[/b].It will turn into this (with a little cleaning.):
This is my text with <b>bold</b> words. <b>Sometimes they are</b> nested.But what I really wanted, was this (with a little cleaning.):
This is my text with <b>bold</b> words. <b>Sometimes they are nested</b>.I've tried a lot of different things, but always seems to run into a dead end. I'm hoping it's simply because I do not know enough about patterns, but I could really need some inspiration or guidance. Seems I'm running out of new things to try.
Edited by: bsindu on Dec 5, 2007 1:44 AM

It could be done using some replaceAll(...) operations:
public class Foo {
    public static void main(String[] args) throws Exception {
        String text = "This is my text with bold words. Sometimes the tags [b]are nested[/b].";
        String s = text.
                    replaceAll("(\\[.\\][^\\[]+)\\[.\\]", "$1").    // replace the last tag of two successive 's
replaceAll("\\[.\\]([^\\[]+\\[.\\])", "$1"). // replace the first tag of two successive 's
                    replaceAll("\\[(/?.)\\]", "<$1>");              // replace all and with <b> and </b>
        System.out.println(text);
        System.out.println(s);
}Either a Pattern or a replaceAll(...) solution, both are a bit of a hack, if you ask me.

Similar Messages

  • Regex Pattern For this String ":=)"

    Hello All
    True, this isn't the place to ask this but here it is anyway, if you can help please do.
    Can anybody tell me the regex pattern for this String:
    ":=)"
    Thanks
    John

    Yep, cheers it's ":=\\)"
    public class Test {
         public static void main( String args[] ) {
              String s = "one:=)two:=)three:=)four";
              String ss[] = s.split( ":=\\)" );
              for( int i=0; i<ss.length; i++ )
                   System.out.println( "ss["+i+"] = {" + ss[i] + "}" );
    }resulting in:
    ss[0] = {one}
    ss[1] = {two}
    ss[2] = {three}
    ss[3] = {four}

  • DLNA would be a nice feuture for Bulletin Board

    A nice feature for the bulletin board would be sharing on a dlna renderer.
    windows 7 can send multimedia out of the exporer ("Play to") to a dlna renderer (e.g. TV set).
    The bulletin board is missing this option.
    I would imagine anything like the dlna sharing on a Tablet S.

    Nice thoughts. It will be nice that Toshiba software engineers read this forum. ;)

  • Regex - Pattern for positive numbers

    Hi,
    I wanna check for positive numbers.
    My code so far:
    Pattern p = Pattern.compile("\\d+");
    Matcher m = p.matcher(str);
    boolean b = m.matches(); But I don't know how to check for positive numbers (including 0).
    Thanks
    Jonny

    Just to make your life easier:
    package samples;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    * @author notivago
    public class Positive {
        public static void main(String[] args) {
            String input = "- 12 +10 10 -12 15 -12,000 10,000 5,000.42";
            Pattern p = Pattern.compile( "\\b(?<!-\\s?|\\.|,)([0-9]+(?:,?[0-9]{3})*(?:\\.[0-9]*)?)" );
            Matcher matcher = p.matcher( input );
            while( matcher.find() ) {
                System.out.println( "Match: " + matcher.group(1) );
    }

  • What's the regex pattern for regular English chars and numbers ...

    In Java String there is a matches(String regex) method, how can I specify the regex for regular English chars, I want it to tell me if the string contains non-English chars. The string is from an email, my application wants to know if the email contains any foreign characters, such as French, Spanish, Chinese ...
    So if the string looks like this : "Hi Frank, today is (5-7-2007), my address is : '[email protected]', email me ~ ! ^_^, do you know 1+2=3 ? AT&T, 200%, *[$300] | {#123}, / _ \;"
    It should recognize it as regular English characters.
    But if it contains any foreign language (outside of a-z) chars either western(Russian, Greek ...) or eastern languages (Japanese, Chinese ...), it should return false.
    I wonder how to write this "regex" ?
    Frank

    since french, english, and spanish use thesame
    alphabet, i don't know how you will have theregex
    for "english chars but not french or spanishones"
    :)Not true. Spanish has �
    KajAlso ll.ll was in 1994 dropped from the Spanish alphabet. :)No shit?
    What about ch and rr?

  • Login and bulletin board

    I am in the process of redesigning our intranet. How hard is
    it to have a login to a part of this site? What I am hoping to do
    is to create a bulletin board for employees, but not everyone would
    see it. There would also be documents posted within this secure
    area. Any help you can give me on creating this login option and
    bulletin board would be greatly appreciated.

    unless it's actually more complex than what you're
    describing, i would
    just use a forum. you can set it so that only registered
    users can log
    in and see everything. and you can upload files and stuff.
    there's lots of free ones out there, but i'm partial to phpBB
    forums
    (the "BB" actually stands for bulletin board), myself.
    http://www.phpbb.com/
    i would take a look at that and see if it can do what you're
    looking for.
    msvobodabe wrote:
    > I am in the process of redesigning our intranet. How
    hard is it to have a
    > login to a part of this site? What I am hoping to do is
    to create a bulletin
    > board for employees, but not everyone would see it.
    There would also be
    > documents posted within this secure area. Any help you
    can give me on creating
    > this login option and bulletin board would be greatly
    appreciated.
    >

  • How to create a Bulletin Board

    Hi Experts,
    I am very New to EP......
    I have a requirement of creating a Bulletin Board.....
    If any body have step by step approach kindly send it to [email protected]
    More points will reward for the useful input.....
    Thanks in Advance,
    Jasmine

    Hello Jasmine,
    you can use XML Forms.
    Test it in KM Folder /documents! Click in the folder context menu "new->forms->SAP Demo News".
    http://help.sap.com/saphelp_nw04/helpdata/en/8e/4470695c686642855af4736da51da0/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/69/d96b9ba84611d5993600508b6b8b11/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/8f/fe743c74fa6449e10000000a11402f/frameset.htm
    best regards,
    Michael

  • Bulletin Board for A505-6980

    Does anyone know how to find the Bulletin Board on a A505-6980?  The advertisement for this machine says that the Bulletin Board in available on this machine but I cannot find in on the computer.

    Satellite A505-S6980
    Mystery to me. I don't see anything about it in the specs above.
    And I don't see anything in the User's Guide.
       Satellite A500 Series User’s Guide
    More about it here.
       Toshiba Bulletin Board
    Let us know if you figure this one out.
    -Jerry

  • How to  create new pattern for se38 with  200 line

    Hi ,
             i want  to create a new pattern as a template  for  report.
    when i checked  it allows me to write only 100  lines.  but in our prj we do use  200 lines of template  .how do i create it .

    Hi,
    Try this following code in the first line of the report in SE38
    Report sy-repid line-count 200.
    Regards,
    Mansi.

  • Re: Download Toshiba Bulletin Board for Windows 8

    My wife has a Satellite L870-18V running Windows 8.
    She has noticed me using my Bulletin Board on my rather older Toshiba Satellite L650-12Q (with Windows 7) and wants one!
    Is it possible to download Bulletin Board to her computer, as it is not pre-loaded on her system?

    The Toshiba Bulletin Board upgrade was available for notebooks which where preinstalled with Windows 7 and supports an official upgrade to Windows 8.
    Such Toshiba BB upgrade could be downloaded from Toshiba EU driver page.
    [Toshiba Bulletin Board v2.1.21 Windows 8 Upgrade |http://www.toshiba.eu/innovation/download_driver_details.jsp?service=EU&selCategory =2&selFamily=2&selSeries=363&selProduct=7400&selSh ortMod=null&language=13&selOS=all&selType=373&year upload=&monthupload=&dayupload=&useDate=null&mode= allMachines&search=&action=search&macId=&country=a ll&selectedLanguage=13&type=373&page=1&ID=85103&OS ID=42&driverLanguage=42]
    But as far as I know Toshiba Bulletin Board is not available anymore for notebook which were released with Windows 8 or Windows 8.1

  • Creating a bulletin board

    Hi all
    I want to craete a bulletin board in collaboration/KM. I am not getting required material /docs . Can anyone plss provide some related gud links or documents ?
    Thanks & Regards

    Hi Shilpa,
    please check the following guid:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/0f20a1b3-0801-0010-1891-c782d7b81921
    regards,
    anja

  • TMADMIN_CAT:188: ERROR: Error while obtaining the Bulletin Board parameters

    Hi ,everybody
    When I created and configured a App server domanin with PSADMIN, these errors below occurred,but log files didn't have useful info:
    PeopleSoft Domain Boot Menu
    Domain Name: HCMDOM
    1) Boot (Serial Boot)
    2) Parallel Boot
    q) Quit
    Command to execute (1-2, q) [q]: 1
    Archived a copy of the domain configuration to /appfs/people/opt/PS/PS_CFG_HOME/appserv/HCMDOM/Archive/psappsrv.cfg
    Attempting to boot bulletin board...
    tmadmin - Copyright (c) 2007-2008 Oracle.
    Portions * Copyright 1986-1997 RSA Data Security, Inc.
    All Rights Reserved.
    Distributed under license by Oracle.
    Tuxedo is a registered trademark.
    TMADMIN_CAT:188: ERROR: Error while obtaining the Bulletin Board parameters
    ==============ERROR!================
    Boot attempt encountered errors!. Check the TUXEDO log for details.
    ==============ERROR!================
    Do you wish to see the error messages in the domain log file? (y/n) [n] :y
    PSADMIN.23310 (0) [11/30/12 10:58:42](0) Begin boot attempt on domain HCMDOM
    PSADMIN.23310 (0) [11/30/12 10:58:42](0) End boot attempt on domain HCMDOM
    Do you wish to see the error messages in the Tuxedo log file? (y/n) [n] : y
    105842.peoplesoft.ynby.cn!PSADMIN.23310: Begin attempt on domain HCMDOM
    105842.peoplesoft.ynby.cn!PSADMIN.23310: End boot attempt on domain HCMDOM
    Press Enter to continue...
    Don't know how to solve it ...

    Hi,Nicolas
    Before I booted up the app server ,I set the environment variable PS_CFG_HOME to /appfs/people/opt/PS/PS_CFG_HOME,and the above error occured,but when I unset the PS_CFG_HOME,it booted up successfully.But another error occured when booted up :
    exec PSMONITORSRV -o ./LOGS/stdout -e ./LOGS/stderr -A -- -ID 232457 -D TESTSERV -S PSMONITORSRV : Failed.
    tmboot: CMDTUX_CAT:827: ERROR: Fatal error encountered; initiating user error handler
    exec tmshutdown -qy
    I checked the pemission to boot up app server :
    SQL> SELECT CLASSID, STARTAPPSERVER FROM PSCLASSDEFN WHERE CLASSID IN (SELECT OPRCLASS FROM PSOPRCLS WHERE OPRID='PS');
    CLASSID STARTAPPSERVER
    PSAPPS 1
    EOEN9000 1
    EOCO9000 1
    PTPT1100 1
    PTPT1200 1
    PTPT1300 1
    and update:
    SQL> UPDATE PSCLASSDEFN SET STARTAPPSERVER=1 WHERE CLASSID='PSAPPS';
    1 row updated.
    SQL> UPDATE PSCLASSDEFN SET STARTAPPSERVER=1 WHERE
    CLASSID='EOEN9000';
    1 row updated.
    SQL> UPDATE PSCLASSDEFN SET STARTAPPSERVER=1 WHERE
    CLASSID='EOCO9000';
    1 row updated.
    SQL> UPDATE PSCLASSDEFN SET STARTAPPSERVER=1 WHERE CLASSID='PTPT1100';
    1 row updated.
    SQL> UPDATE PSCLASSDEFN SET STARTAPPSERVER=1 WHERE CLASSID='PTPT1200';
    1 row updated.
    SQL> UPDATE PSCLASSDEFN SET STARTAPPSERVER=1 WHERE CLASSID='PTPT1300';
    1 row updated.
    After doing these,it booted up with the error:
    exec PSRENSRV -o ./LOGS/stdout -e ./LOGS/stderr -A -- -D TESTSERV -S PSRENSRV :
    Failed.
    tmboot: CMDTUX_CAT:827: ERROR: Fatal error encountered; initiating user error handler
    Then I configured the REN server :
    Values for config section - PSRENSRV
    log_severity_level=Warning
    io_buffer_size=8192
    default_http_port=7180
    default_https_port=7143
    default_auth_token=<my hostname>
    Boot up app server again :
    Booting server processes ...
    exec PSWATCHSRV -o ./LOGS/stdout -e ./LOGS/stderr -A -- -ID 42933 -D TESTSERV -S PSWATCHSRV :
    process id=24245 ... Started.
    exec PSAPPSRV -o ./LOGS/stdout -e ./LOGS/stderr [email protected] -- -D TESTSERV -S PSAPPSRV :
    process id=24246 ... Started.
    exec PSAPPSRV -o ./LOGS/stdout -e ./LOGS/stderr [email protected] -- -D TESTSERV -S PSAPPSRV :
    process id=24256 ... Started.
    exec PSSAMSRV -o ./LOGS/stdout -e ./LOGS/stderr -A -- -D TESTSERV -S PSSAMSRV :
    process id=24266 ... Started.
    exec PSRENSRV -o ./LOGS/stdout -e ./LOGS/stderr -A -- -D TESTSERV -S PSRENSRV :
    process id=24273 ... Started.
    exec PSMONITORSRV -o ./LOGS/stdout -e ./LOGS/stderr -A -- -ID 42933 -D TESTSERV -S PSMONITORSRV :
    process id=24279 ... Started.
    exec WSL -o ./LOGS/stdout -e ./LOGS/stderr -A -- -n //<my hostname>:7000 -z 0 -Z 0 -I 5 -T 60 -m 1 -M 3 -x 40 -c 5000 -p 7001 -P 7003 :
    process id=6834 ... Started.
    7 processes started.
    Here is my configurations:
    OS:RHEL 5.4
    DATABASE:ORACLE Database 11.2.0.1
    Peoplesoft Tools: 8.52
    Application version:HCM 9.1
    Domain configuration:
    Quick-configure menu -- domain: HCMAPP
    Features Settings
    ========== ==========
    1) Pub/Sub Servers : No 16) DBNAME :[PEOPDB]
    2) Quick Server : No 17) DBTYPE :[ORACLE]
    3) Query Servers : No 18) UserId :[PS]
    4) Jolt : No 19) UserPswd :[PS]
    5) Jolt Relay : No 20) DomainID :[TESTSERV]
    6) WSL : Yes 21) AddToPATH :[.]
    7) PC Debugger : No 22) ConnectID :[people]
    8) Event Notification: Yes 23) ConnectPswd:[peop1e]
    9) MCF Servers : No 24) ServerName :[<my hostname>]
    10) Perf Collator : No 25) WSL Port :[7000]
    11) Analytic Servers : No 26) JSL Port :[9000]
    12) Domains Gateway : No 27) JRAD Port :[9100]
    It seems OK,But when I tested the 3-tier connection :
    It prompted: Could not connect to appliaction server HCMAPP.possible causes are:the server name/IP address and port for the application server alias are incorrect....
    Contect your system administrator to check the Tuxedo log for more information
    But I can sign on the database using Application Designer,and app server already booted up.
    Additional ,the Tuxedo and Weblogic were installed within different directorys,does it matter?
    Do you need more configuration info?
    Thanks for you to reply my questions ~

  • Apache Sling JCR Resource Resolver doesn't work for the anchor tags which is been rendered through j

    Certainly I realized that Apache Sling JCR Resource Resolver doesn't work for the anchor tags which is been rendered through jquery or javascript.
    e.g.
    In Felix Console , in Apache Sling JCR Resource Resolver configuration I have added following mapping.
    /content/myproject/-/
    So If any anchor tag is there like <a href="/content/myproject/en.html"> click me </a> then it will be mapped to "/en.html" automatically.
    But the problem is there in following scenario.
    I have an anchor tag as follows.
    <a href="#" id="test"> click here </a>
    And I am assigning the href to anchor through JQUERY.
    <script>
    $("#test").attr("href","/content/myproject/en.html");
    </script>
    Ideally this should have been mapped to "/en.html".
    But it is not mapping to "/en.html". It still shows "/content/myproject/en.html".
    How to resolve this.
    Thanks,
    Sai

    In a servlet you have access to the resourceResolver so if you know which attributes contain links then it's relatively easy to apply resourceResolver.map to those links.
    Your challenge is clearly how do you know which attributes are links and which aren't. Its is the same challenge that makes parsing the response and rewriting it on the way out difficult - the JSON doesn't have any semantic meaning so how do identify which attributes require rewriting. There really is no good answer ot that question in my experience - all the options have down sides.
    Create some convention - all attributes matching this pattern X get mapped before being converted to JSON (could be attributes whose name ends in link, or it could a convention applied to the value of the attribute - if the attribute is a string that starts with /content apply the resource resolver mapping. In this case you have train your developers to follow this convention which is the down side.
    Create some configurable list of attribute names that require mapping. This is brittle, requires training and is easy to break.
    Implement a client side version of the resource resolver mapping. It wouldn't be as full proof as server side mapping (because that takes into account but you could make it work for simple logic like stripping of /content/site/en. If ou are just trying to solve the simple version of this issue - stripping off the top of the repository path this might be your best option.
    Not worry about it and set up Apache 301 redirects that catch any long URLs and redirect them to short URLs (so configure apache to look for any URL matching /content/site/en and strip off /content/site/en and do a 301 redirect to the shortened URL. You end up with a lot of extra HTTP request because of all the 301s but it would work (I wouldn't recommend this option - but it is possible).

  • Toshiba Bulletin Board labels grayed out

    New laptop and Bulletin Board was working just fine for the first few days.  Now the labels gadget is grayed out and cannot be accessed.  I really like using the labels and want them back.  I'm afraid to do an uninstall and install because I have a  lot of information on a couple of boards I have created and I don't want to lose the data.
    Any suggestions?

    Thanks for responding, Jerry! I realized that I had forgotten to put the model and parts #s in my Post the minute I clicked. Here they are:
    Toshiba NB 305-N410BL
    Part# PLL3AU-00G00C
    I have another issue vis-a-vis the labels on the bottom of the laptop.  I have a Microsoft sticker with a Product key # for Windows but I do not have a separate sticker for Microsoft Office (or for  Microsoft Works - assuming that suite has its own sticker).  In the past my HP and Dell laptops have had such software stickers either underneath the laptop itself near the Microsoft Windows label or somewhere on the outside of the box the laptop was packed in...or on the disc or CD (there are no discs or CDS with this Toshiba - like most if not all new computers).
    Do you have any ideas how might get my Product Key # for my Microsoft Office Suite?  I can only use this software 25 times without registering...and I have 22 uses left.  I write a lot and don't this software to lock up on me.
    Many thanks!
    Alex

  • Bulletin Board in SAP

    HI All,
    I am creating a new bulletin board. Can anyone please help me on how to start as I am a newbie to the teamroom.
    Any document would really help.
    points are awarded for sure***
    Cheers,
    Satya

    Hello Sathya,
    Here are some links which will fulfill your requirement.
    https://www.sdn.sap.com/irj/sdn/wipro
    https://www.sdn.sap.com/irj/sdn/message?messageID=4472580
    http://help.sap.com/saphelp_nw04/helpdata/en/44/f99140c2eab118e10000000a1550b0/content.htm
    .If u find any problem please feel free to contact me .I will send you more documents if i get as per your requirements.
    With Warm Regards,
    Rakesh Kumar Verma.

Maybe you are looking for

  • BW Reporting Issue

    Hi, I am facing one reporting Issue relating to Display Attributes. Characteristic: Business Partner Display Attributes: Address0, Address1, Address3...etc. Requirement is to display mentioned Display attributes along with Business Partner. For this

  • Embed fonts in pdf with Photoshop CC?

    Hi, I have done my CV using Photoshop so it's full of text with specific fonts. My problem is that when I save the CV in .pdf file, people can't see the pdf correctly if they don't have those specific fonts. I don't want to sent my CV as an image, so

  • HT4859 How do I retrieve my photos from the cloud after a reset. My photos are gone from my phone, and I backed them up on iCloud?

    How do I retrieve my photos from the cloud after a reset. My photos are gone from my phone, and I backed them up on iCloud? when I restored it, no camera roll pictures?

  • Making a vector shape from a design

    Hello all, I've been a very casual photoshop user for years, and know the basics of the program. However I'm a bit stumped with a current task. I recently had a friend do a single color shape-based logo design for my band. I love what he came up with

  • VC - Chart View

    Hi, I have an output table in VC. Two columns in this table have a series of 1's and 0's. I want to use these columns to create a chart which is populated by the 1's only. Any advice how I can achieve this? Thanks MM